Hi Frank,
It looks like you commented out the end flag in the MonitorList Table which is likely to cause the program to crash.
change
//{0,0,0} // end flag
to
{0,0,0} // end flag
Your links to cncretrofit.nl don't work for me.
Also notice in the example there are 8 things for each entry in the table (6 characters and 2 numbers) as described in the comment
// string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added as necessary.
//{"\x01\x04\xE0\x00\x00\x01", 6, 0}, // Read inputs to MBRegisters[0]
you changed to 6 things?? (4 characters and 2 numbers):
{"\x3A\x01\x11\xEE", 4, 0}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
Similarly the changes to the other table don't fit the required format.
I would also remove everything in the Connect list as it is not really needed to read the diagnostic
information (but leave the end flag)
Regards TK
Group: DynoMotion |
Message: 7311 |
From: frank_19_88 |
Date: 4/21/2013 |
Subject: Re: Kanalog -> RS232 -> Innomotion PLC |
Hi TK,
At ' http://www.cncretrofit.nl/Kflop/RS232 - Console.txt' you can see the console information
At ' http://www.cncretrofit.nl/Kflop/RS232 - DRS232 - VP_ communication Protocol.doc' you can find the communication protocol of the PLC. (I have 8 inputs and 6 outputs on de PLC, and an IO board with 8 inputs and 8 outputs)
At ' http://www.cncretrofit.nl/Kflop/ModbusMasterVer1.c' you will find the new .c file
Or: ' http://www.cncretrofit.nl/Kflop/kflop.rar'
Or: ' http://www.hoefon.nl/kflop/kflop.rar'
I did add the flag, the program doesn't crash any more.
The documentation of the PLC say:
Command code 17: 3A;01;11;EE
Heading :3A
Slave address :01
command code :11
error check (LRC) :EE
Command code 01: 3A;01;01;04;00;00;08;BF;CR;LF
Command code 15: 0F;05;00;00;06;01;3F;11;CR;LF
( I think CR;LF is strange because it is not hexadecimal )
I hope you can open de documents.
Maybe I have the wrong communication settings?
1. Communication Interface: RS-232C
2. Communication Protocol ASCII mode, 9600(Baud rate),7(Data length), EVEN(Parity),1(Stop bit)
3. Communication Data Frame
STX Start character `:'(3AH)
ADR 1 Communication address:
ADR 0 8-bit address consists of 2 ASCII codes
CMD 1 Command code:
CMD 0 8-bit command consists of 2 ASCII codes
DATA(0) Contents of data:
DATA(1) n8-bit data consist of 2n ASCII codes.
. n37, maximum of 74 ASCII codes
DATA(n-1)
LRC CHK 1 LRC check sum:
LRC CHK 0 8-bit check sum consists of 2 ASCII codes
END 1 End character:
END 0 END 1 = CR(0DH),END 0 = LF(0AH)
With kind regards,
Frank
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Frank,
>
> It looks like you commented out the end flag in the MonitorList Table which is likely to cause the program to crash.
>
> change
>
> //{0,0,0} // end flag
>
> to
>
> {0,0,0} // end flag
>
> Your links to cncretrofit.nl don't work for me.
>
>
> Also notice in the example there are 8 things for each entry in the table (6 characters and 2 numbers) as described in the comment
>
>
> // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added as necessary.
> //{"\x01\x04\xE0\x00\x00\x01", 6, 0}, // Read inputs to MBRegisters[0]
>
> you changed to 6 things?? (4 characters and 2 numbers):
>
> {"\x3A\x01\x11\xEE", 4, 0}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
>
>
>
> Similarly the changes to the other table don't fit the required format.
>
>
> I would also remove everything in the Connect list as it is not really needed to read the diagnostic information (but leave the end flag)
>
>
>
> Regards
> TK
>
>
>
> ________________________________
> From: frank_19_88 <frank_19_88@...>
> To: DynoMotion@yahoogroups.com
> Sent: Sunday, April 21, 2013 10:22 AM
> Subject: [DynoMotion] Kanalog -> RS232 -> Innomotion PLC
>
>
>
> Â
> Hey TK,
>
> At the moment I started the rs232 project.
>
> I am using KMotion430f.exe (Kflop + Kanalog)
> And did buy this plc: http://www.innomotion.eu/plc/dvp-ss2.html
> And connected Kanalog rs232 to the plc (Connected the transfer bit from the Kanalog to the receive bit of the PLC and receive to transfer and ground to ground)
>
> I did change your ModbusMasterVer1.c:
> ModbusMaster_Cmds ModbusMaster_ConnectList[] =
> {
> // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added.
> //{"\x01\x04\xF0\x00\x00\x10", 6, 2}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> {"\x3A\x01\x11\xEE", 4, 0}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> {0,0,0} // end flag
> };
>
> ModbusMaster_Cmds ModbusMaster_MonitorList[] =
> {
> // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added as necessary.
> //{"\x01\x04\xE0\x00\x00\x01", 6, 0}, // Read inputs to MBRegisters[0]
> //{"\x01\x10\xE2\x00\x00\x01", 6, 1}, // Write outputs from MBRegisters[1]
> {"\3A\x01\x01\x04\x00\x00\x08\xBF", 8, 0}, // Read inputs to MBRegisters[0]
> {"\x0F\x05\x00\x00\x06\x02\xCD\x01\x11", 9, 1}, // Write outputs from MBRegisters[1]
> //{0,0,0} // end flag
> };
> And changed baud rate to 9600.
>
> But when I run the code it gives me an error 'Read failed - Auto disconnect'
> At 'www.cncretrofit.nl/Kflop/RS232 - Console.txt' you can see the console information
> At 'www.cncretrofit.nl/Kflop/RS232 - DRS232 - VP_ communication Protocol.doc' you can find the communication protocol of the PLC. (I have 8 inputs and 6 outputs on de PLC, and an IO board with 8 inputs and 8 outputs)
> At 'www.cncretrofit.nl/Kflop/ModbusMasterVer1.c' you will find the new .c file
>
> Command code 17: {"\x3A\x01\x11\xEE", 4, 0}
> Command code 01: {"\3A\x01\x01\x04\x00\x00\x08\xBF\xCR\xLF", 10, 0}, // 04 "X" are inputs, Read inputs to MBRegisters[0]
> Command code 15: {"\x0F\x05\x00\x00\x06\x02\xCD\x01\x11\xCR\xLF", 11, 0}, // 05 "Y" are outputs Write outputs from MBRegisters[1]
>
> Can you/I write an C program to send 3A:01:11:EE to the PLC? And read the answer to check the connection?
> After that we can try to read/write the PLC.
>
> Thank you,
>
> Frank
>
|
|
Group: DynoMotion |
Message: 7315 |
From: Tom Kerekes |
Date: 4/22/2013 |
Subject: Re: Kanalog -> RS232 -> Innomotion PLC |
Hi Frank,
I was able to download the .rar file only.
Like I said previously I would make the connnect List empty to simplify things as that was just intended to read version info and such from the PLC. so delete
{"\x3A\x01\x11\xEE", 4, 0}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
Also use:
EnableRS232Cmds(RS232_BAUD_9600);
for 9600 baud.
The PLC document talks about 7bits even parity. KFLOP only does 8 bits no parity (although it would be possible to add parity in software), but the hex command examples seem to be no parity.
It isn't clear to me from their documentation if that ":" character or STX or 0x3A is actually needed and sent. I would try removing it.
The CR and LF are carriage return and line feed characters. But the checksum and those are added automatically.
You may want to connect your PLC to a PC and user TeraTerm to type characters to test things first.
Regards TK
Group: DynoMotion |
Message: 7331 |
From: frank_19_88 |
Date: 4/26/2013 |
Subject: Re: Kanalog -> RS232 -> Innomotion PLC |
Hi TK,
I changed the PLC settings from "9600,7,even,1" To "Baud:38400, 8 Bits, None, 1 stop bit".
But I don't know how I can send "\x01\x10\xE2\x00\x00\x01" with teraterm. (Also tried realterm)
I am enable to change the PLC outputs with the PC software "delta soft: ISPSoft V1.03" (true rs232) but I can't monitor the com port at that time.
With kind regards,
Frank
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Frank,
>
>
> I was able to download the .rar file only.
>
> Like I said previously I would make the connnect List empty to simplify things as that was just intended to read version info and such from the PLC. so delete   Â
>
>
> {"\x3A\x01\x11\xEE", 4, 0},   // Collect PLC firmware info block MBRegisters[10] for 16 registers
>
> Also use:
>
> Â Â Â EnableRS232Cmds(RS232_BAUD_9600);
>
>
> for 9600 baud.
>
> The PLC document talks about 7bits even parity. KFLOP only does 8 bits no parity (although it would be possible to add parity in software), but the hex command examples seem to be no parity.
>
> It isn't clear to me from their documentation if that ":" character or STX or 0x3A is actually needed and sent. I would try removing it.
>
> The CR and LF are carriage return and line feed characters. But the checksum and those are added automatically.
>
> You may want to connect your PLC to a PC and user TeraTerm to type characters to test things first.
>
> Regards
> TK
>
>
>
>
> ________________________________
> From: frank_19_88 <frank_19_88@...>
> To: DynoMotion@yahoogroups.com
> Sent: Sunday, April 21, 2013 2:04 PM
> Subject: [DynoMotion] Re: Kanalog -> RS232 -> Innomotion PLC
>
>
>
> Â
> Hi TK,
>
> At 'http://www.cncretrofit.nl/Kflop/RS232 - Console.txt' you can see the console information
> At 'http://www.cncretrofit.nl/Kflop/RS232 - DRS232 - VP_ communication Protocol.doc' you can find the communication protocol of the PLC. (I have 8 inputs and 6 outputs on de PLC, and an IO board with 8 inputs and 8 outputs)
> At 'http://www.cncretrofit.nl/Kflop/ModbusMasterVer1.c' you will find the new .c file
>
> Or: 'http://www.cncretrofit.nl/Kflop/kflop.rar'
> Or: 'http://www.hoefon.nl/kflop/kflop.rar'
>
> I did add the flag, the program doesn't crash any more.
>
> The documentation of the PLC say:
> Command code 17: 3A;01;11;EE
> Heading :3A
> Slave address :01
> command code :11
> error check (LRC) :EE
>
> Command code 01: 3A;01;01;04;00;00;08;BF;CR;LF
> Command code 15: 0F;05;00;00;06;01;3F;11;CR;LF
> ( I think CR;LF is strange because it is not hexadecimal )
>
> I hope you can open de documents.
> Maybe I have the wrong communication settings?
>
> 1. Communication Interface: RS-232C
> 2. Communication Protocol ASCII mode, 9600(Baud rate),7(Data length), EVEN(Parity),1(Stop bit)
> 3. Communication Data Frame
> STX Start character `:'(3AH)
> ADR 1 Communication address:
> ADR 0 8-bit address consists of 2 ASCII codes
> CMD 1 Command code:
> CMD 0 8-bit command consists of 2 ASCII codes
> DATA(0) Contents of data:
> DATA(1) n8-bit data consist of 2n ASCII codes.
> â¦â¦â¦. n37, maximum of 74 ASCII codes
> DATA(n-1)
> LRC CHK 1 LRC check sum:
> LRC CHK 0 8-bit check sum consists of 2 ASCII codes
> END 1 End character:
> END 0 END 1 = CR(0DH),END 0 = LF(0AH)
>
> With kind regards,
>
> Frank
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Frank,
> >
> > It looks like you commented out the end flag in the MonitorList Table which is likely to cause the program to crash.
> >
> > change
> >
> > //{0,0,0} // end flag
> >
> > to
> >
> > {0,0,0} // end flag
> >
> > Your links to cncretrofit.nl don't work for me.
> >
> >
> > Also notice in the example there are 8 things for each entry in the table (6 characters and 2 numbers) as described in the comment
> >
> >
> > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added as necessary.
> > //{"\x01\x04\xE0\x00\x00\x01", 6, 0}, // Read inputs to MBRegisters[0]
> >
> > you changed to 6 things??ÃÂ (4 characters and 2 numbers):
> >
> > {"\x3A\x01\x11\xEE", 4, 0}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> >
> >
> >
> > Similarly the changes to the other table don't fit the required format.
> >
> >
> > I would also remove everything in the Connect list as it is not really needed to read the diagnostic information (but leave the end flag)
> >
> >
> >
> > Regards
> > TK
> >
> >
> >
> > ________________________________
> > From: frank_19_88 <frank_19_88@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Sunday, April 21, 2013 10:22 AM
> > Subject: [DynoMotion] Kanalog -> RS232 -> Innomotion PLC
> >
> >
> >
> > ÃÂ
> > Hey TK,
> >
> > At the moment I started the rs232 project.
> >
> > I am using KMotion430f.exe (Kflop + Kanalog)
> > And did buy this plc: http://www.innomotion.eu/plc/dvp-ss2.html
> > And connected Kanalog rs232 to the plc (Connected the transfer bit from the Kanalog to the receive bit of the PLC and receive to transfer and ground to ground)
> >
> > I did change your ModbusMasterVer1.c:
> > ModbusMaster_Cmds ModbusMaster_ConnectList[] =
> > {
> > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added.
> > //{"\x01\x04\xF0\x00\x00\x10", 6, 2}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > {"\x3A\x01\x11\xEE", 4, 0}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > {0,0,0} // end flag
> > };
> >
> > ModbusMaster_Cmds ModbusMaster_MonitorList[] =
> > {
> > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added as necessary.
> > //{"\x01\x04\xE0\x00\x00\x01", 6, 0}, // Read inputs to MBRegisters[0]
> > //{"\x01\x10\xE2\x00\x00\x01", 6, 1}, // Write outputs from MBRegisters[1]
> > {"\3A\x01\x01\x04\x00\x00\x08\xBF", 8, 0}, // Read inputs to MBRegisters[0]
> > {"\x0F\x05\x00\x00\x06\x02\xCD\x01\x11", 9, 1}, // Write outputs from MBRegisters[1]
> > //{0,0,0} // end flag
> > };
> > And changed baud rate to 9600.
> >
> > But when I run the code it gives me an error 'Read failed - Auto disconnect'
> > At 'www.cncretrofit.nl/Kflop/RS232 - Console.txt' you can see the console information
> > At 'www.cncretrofit.nl/Kflop/RS232 - DRS232 - VP_ communication Protocol.doc' you can find the communication protocol of the PLC. (I have 8 inputs and 6 outputs on de PLC, and an IO board with 8 inputs and 8 outputs)
> > At 'www.cncretrofit.nl/Kflop/ModbusMasterVer1.c' you will find the new .c file
> >
> > Command code 17: {"\x3A\x01\x11\xEE", 4, 0}
> > Command code 01: {"\3A\x01\x01\x04\x00\x00\x08\xBF\xCR\xLF", 10, 0}, // 04 "X" are inputs, Read inputs to MBRegisters[0]
> > Command code 15: {"\x0F\x05\x00\x00\x06\x02\xCD\x01\x11\xCR\xLF", 11, 0}, // 05 "Y" are outputs Write outputs from MBRegisters[1]
> >
> > Can you/I write an C program to send 3A:01:11:EE to the PLC? And read the answer to check the connection?
> > After that we can try to read/write the PLC.
> >
> > Thank you,
> >
> > Frank
> >
>
|
|
Group: DynoMotion |
Message: 7335 |
From: frank_19_88 |
Date: 4/27/2013 |
Subject: Re: Kanalog -> RS232 -> Innomotion PLC |
Hi TK,
(Also see my message from yesterday)
Today I did change baud rate from kflop back to 38400 at the .c file.
I think the modbus commands are very similar, Innomotion PLC also support this
command:
{"\x01\x10\x05\x00\x00\x01", 6, 1}, // Write outputs
"x05" instead of "xE2" because the outputs are at and different address.
At the console I receive:
"Tx:01;10;05;00;00;01;02;00;3f;b3;40;"
I think the problem is at the Error Check (LRC) kflop sends 2 byte's and the PLC
document says 1 byte.
"3f" changed :) when 56-61 change :)
Maybe useful:
http://www.kavrammuhendislik.com.tr/dokumanlar/DELTA_DVP-ES2_SS2_SA2_SX2-Program_O_EN_20110302.pdf
Hope you have any idea how to fix it.
Frank
--- In DynoMotion@yahoogroups.com, "frank_19_88" <frank_19_88@...> wrote:
>
> Hi TK,
>
> I changed the PLC settings from "9600,7,even,1" To "Baud:38400, 8 Bits, None, 1 stop bit".
>
> But I don't know how I can send "\x01\x10\xE2\x00\x00\x01" with teraterm. (Also tried realterm)
>
> I am enable to change the PLC outputs with the PC software "delta soft: ISPSoft V1.03" (true rs232) but I can't monitor the com port at that time.
>
> With kind regards,
>
> Frank
>
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Frank,
> >
> >
> > I was able to download the .rar file only.
> >
> > Like I said previously I would make the connnect List empty to simplify things as that was just intended to read version info and such from the PLC. so delete   Â
> >
> >
> > {"\x3A\x01\x11\xEE", 4, 0},   // Collect PLC firmware info block MBRegisters[10] for 16 registers
> >
> > Also use:
> >
> > Â Â Â EnableRS232Cmds(RS232_BAUD_9600);
> >
> >
> > for 9600 baud.
> >
> > The PLC document talks about 7bits even parity. KFLOP only does 8 bits no parity (although it would be possible to add parity in software), but the hex command examples seem to be no parity.
> >
> > It isn't clear to me from their documentation if that ":" character or STX or 0x3A is actually needed and sent. I would try removing it.
> >
> > The CR and LF are carriage return and line feed characters. But the checksum and those are added automatically.
> >
> > You may want to connect your PLC to a PC and user TeraTerm to type characters to test things first.
> >
> > Regards
> > TK
> >
> >
> >
> >
> > ________________________________
> > From: frank_19_88 <frank_19_88@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Sunday, April 21, 2013 2:04 PM
> > Subject: [DynoMotion] Re: Kanalog -> RS232 -> Innomotion PLC
> >
> >
> >
> > Â
> > Hi TK,
> >
> > At 'http://www.cncretrofit.nl/Kflop/RS232 - Console.txt' you can see the console information
> > At 'http://www.cncretrofit.nl/Kflop/RS232 - DRS232 - VP_ communication Protocol.doc' you can find the communication protocol of the PLC. (I have 8 inputs and 6 outputs on de PLC, and an IO board with 8 inputs and 8 outputs)
> > At 'http://www.cncretrofit.nl/Kflop/ModbusMasterVer1.c' you will find the new .c file
> >
> > Or: 'http://www.cncretrofit.nl/Kflop/kflop.rar'
> > Or: 'http://www.hoefon.nl/kflop/kflop.rar'
> >
> > I did add the flag, the program doesn't crash any more.
> >
> > The documentation of the PLC say:
> > Command code 17: 3A;01;11;EE
> > Heading :3A
> > Slave address :01
> > command code :11
> > error check (LRC) :EE
> >
> > Command code 01: 3A;01;01;04;00;00;08;BF;CR;LF
> > Command code 15: 0F;05;00;00;06;01;3F;11;CR;LF
> > ( I think CR;LF is strange because it is not hexadecimal )
> >
> > I hope you can open de documents.
> > Maybe I have the wrong communication settings?
> >
> > 1. Communication Interface: RS-232C
> > 2. Communication Protocol ASCII mode, 9600(Baud rate),7(Data length), EVEN(Parity),1(Stop bit)
> > 3. Communication Data Frame
> > STX Start character `:'(3AH)
> > ADR 1 Communication address:
> > ADR 0 8-bit address consists of 2 ASCII codes
> > CMD 1 Command code:
> > CMD 0 8-bit command consists of 2 ASCII codes
> > DATA(0) Contents of data:
> > DATA(1) n8-bit data consist of 2n ASCII codes.
> > â¦â¦â¦. n37, maximum of 74 ASCII codes
> > DATA(n-1)
> > LRC CHK 1 LRC check sum:
> > LRC CHK 0 8-bit check sum consists of 2 ASCII codes
> > END 1 End character:
> > END 0 END 1 = CR(0DH),END 0 = LF(0AH)
> >
> > With kind regards,
> >
> > Frank
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi Frank,
> > >
> > > It looks like you commented out the end flag in the MonitorList Table which is likely to cause the program to crash.
> > >
> > > change
> > >
> > > //{0,0,0} // end flag
> > >
> > > to
> > >
> > > {0,0,0} // end flag
> > >
> > > Your links to cncretrofit.nl don't work for me.
> > >
> > >
> > > Also notice in the example there are 8 things for each entry in the table (6 characters and 2 numbers) as described in the comment
> > >
> > >
> > > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added as necessary.
> > > //{"\x01\x04\xE0\x00\x00\x01", 6, 0}, // Read inputs to MBRegisters[0]
> > >
> > > you changed to 6 things??ÃÂ (4 characters and 2 numbers):
> > >
> > > {"\x3A\x01\x11\xEE", 4, 0}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > >
> > >
> > >
> > > Similarly the changes to the other table don't fit the required format.
> > >
> > >
> > > I would also remove everything in the Connect list as it is not really needed to read the diagnostic information (but leave the end flag)
> > >
> > >
> > >
> > > Regards
> > > TK
> > >
> > >
> > >
> > > ________________________________
> > > From: frank_19_88 <frank_19_88@>
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Sunday, April 21, 2013 10:22 AM
> > > Subject: [DynoMotion] Kanalog -> RS232 -> Innomotion PLC
> > >
> > >
> > >
> > > ÃÂ
> > > Hey TK,
> > >
> > > At the moment I started the rs232 project.
> > >
> > > I am using KMotion430f.exe (Kflop + Kanalog)
> > > And did buy this plc: http://www.innomotion.eu/plc/dvp-ss2.html
> > > And connected Kanalog rs232 to the plc (Connected the transfer bit from the Kanalog to the receive bit of the PLC and receive to transfer and ground to ground)
> > >
> > > I did change your ModbusMasterVer1.c:
> > > ModbusMaster_Cmds ModbusMaster_ConnectList[] =
> > > {
> > > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added.
> > > //{"\x01\x04\xF0\x00\x00\x10", 6, 2}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > {"\x3A\x01\x11\xEE", 4, 0}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > {0,0,0} // end flag
> > > };
> > >
> > > ModbusMaster_Cmds ModbusMaster_MonitorList[] =
> > > {
> > > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added as necessary.
> > > //{"\x01\x04\xE0\x00\x00\x01", 6, 0}, // Read inputs to MBRegisters[0]
> > > //{"\x01\x10\xE2\x00\x00\x01", 6, 1}, // Write outputs from MBRegisters[1]
> > > {"\3A\x01\x01\x04\x00\x00\x08\xBF", 8, 0}, // Read inputs to MBRegisters[0]
> > > {"\x0F\x05\x00\x00\x06\x02\xCD\x01\x11", 9, 1}, // Write outputs from MBRegisters[1]
> > > //{0,0,0} // end flag
> > > };
> > > And changed baud rate to 9600.
> > >
> > > But when I run the code it gives me an error 'Read failed - Auto disconnect'
> > > At 'www.cncretrofit.nl/Kflop/RS232 - Console.txt' you can see the console information
> > > At 'www.cncretrofit.nl/Kflop/RS232 - DRS232 - VP_ communication Protocol.doc' you can find the communication protocol of the PLC. (I have 8 inputs and 6 outputs on de PLC, and an IO board with 8 inputs and 8 outputs)
> > > At 'www.cncretrofit.nl/Kflop/ModbusMasterVer1.c' you will find the new .c file
> > >
> > > Command code 17: {"\x3A\x01\x11\xEE", 4, 0}
> > > Command code 01: {"\3A\x01\x01\x04\x00\x00\x08\xBF\xCR\xLF", 10, 0}, // 04 "X" are inputs, Read inputs to MBRegisters[0]
> > > Command code 15: {"\x0F\x05\x00\x00\x06\x02\xCD\x01\x11\xCR\xLF", 11, 0}, // 05 "Y" are outputs Write outputs from MBRegisters[1]
> > >
> > > Can you/I write an C program to send 3A:01:11:EE to the PLC? And read the answer to check the connection?
> > > After that we can try to read/write the PLC.
> > >
> > > Thank you,
> > >
> > > Frank
> > >
> >
>
|
|
Group: DynoMotion |
Message: 7337 |
From: Tom Kerekes |
Date: 4/27/2013 |
Subject: Re: Kanalog -> RS232 -> Innomotion PLC |
Hi Frank,
Here is where the 16-bit CRC code is added in:
int
csum=CRC16(ModbusMaster_packetBuild,chp-ModbusMaster_packetBuild); *chp++=csum&0xFF; *chp++=(csum>>8)&0xFF;
You would need to change that to do the simple 8-bit sum.
Regards TK
Group: DynoMotion |
Message: 7344 |
From: frank_19_88 |
Date: 4/27/2013 |
Subject: Re: Kanalog -> RS232 -> Innomotion PLC |
HI TK,
I changed it to:
int csum=CRC16(ModbusMaster_packetBuild,chp-ModbusMaster_packetBuild);
*chp++=csum&0xFF;
//*chp++=(csum>>8)&0xFF;
(CRC8, didn't work)
Console changed from "Tx:01;10;05;00;00;01;02;00;3f;b3;40;" to "Tx:01;10;05;00;00;01;02;00;3f;b3;" but still no connection.
Did you test the rs232 connection of the kanalog? (half year ago you said you didn't)
Do I need to upgrade version "430f"?
If you want to try it for your self you can login true Teamviewer or remote desktop.
Or do you have any other suggestions?
With kind regards,
Frank
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Frank,
>
> Here is where the 16-bit CRC code is added in:
>
> Â Â Â int csum=CRC16(ModbusMaster_packetBuild,chp-ModbusMaster_packetBuild);
> Â Â Â *chp++=csum&0xFF;
> Â Â Â *chp++=(csum>>8)&0xFF;
>
>
> You would need to change that to do the simple 8-bit sum.
>
> Regards
> TK
>
>
>
> ________________________________
> From: frank_19_88 <frank_19_88@...>
> To: DynoMotion@yahoogroups.com
> Sent: Saturday, April 27, 2013 11:13 AM
> Subject: [DynoMotion] Re: Kanalog -> RS232 -> Innomotion PLC
>
>
>
> Â
> Hi TK,
>
> (Also see my message from yesterday)
>
> Today I did change baud rate from kflop back to 38400 at the .c file.
> I think the modbus commands are very similar, Innomotion PLC also support this
> command:
> {"\x01\x10\x05\x00\x00\x01", 6, 1}, // Write outputs
> "x05" instead of "xE2" because the outputs are at and different address.
> At the console I receive:
> "Tx:01;10;05;00;00;01;02;00;3f;b3;40;"
> I think the problem is at the Error Check (LRC) kflop sends 2 byte's and the PLC
> document says 1 byte.
>
> "3f" changed :) when 56-61 change :)
> Maybe useful:
> http://www.kavrammuhendislik.com.tr/dokumanlar/DELTA_DVP-ES2_SS2_SA2_SX2-Program_O_EN_20110302.pdf
>
> Hope you have any idea how to fix it.
>
> Frank
>
> --- In DynoMotion@yahoogroups.com, "frank_19_88" <frank_19_88@> wrote:
> >
> > Hi TK,
> >
> > I changed the PLC settings from "9600,7,even,1" To "Baud:38400, 8 Bits, None, 1 stop bit".
> >
> > But I don't know how I can send "\x01\x10\xE2\x00\x00\x01" with teraterm. (Also tried realterm)
> >
> > I am enable to change the PLC outputs with the PC software "delta soft: ISPSoft V1.03" (true rs232) but I can't monitor the com port at that time.
> >
> > With kind regards,
> >
> > Frank
> >
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi Frank,
> > >
> > >
> > > I was able to download the .rar file only.
> > >
> > > Like I said previously I would make the connnect List empty to simplify things as that was just intended to read version info and such from the PLC.ÃÂ so delete ÃÂ ÃÂ ÃÂ
> > >
> > >
> > > {"\x3A\x01\x11\xEE", 4, 0},ÃÂ ÃÂ ÃÂ // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > >
> > > Also use:
> > >
> > > ÃÂ ÃÂ ÃÂ EnableRS232Cmds(RS232_BAUD_9600);
> > >
> > >
> > > for 9600 baud.
> > >
> > > The PLC document talks about 7bits even parity.ÃÂ KFLOP only does 8 bits no parity (although it would be possible to add parity in software), but the hex command examples seem to be no parity.
> > >
> > > It isn't clear to me from their documentation if that ":" character or STX or 0x3A is actually needed and sent.ÃÂ I would try removing it.
> > >
> > > The CR and LF are carriage return and line feed characters.ÃÂ But the checksum and those are added automatically.
> > >
> > > You may want to connect your PLC to a PC and user TeraTerm to type characters to test things first.
> > >
> > > Regards
> > > TK
> > >
> > >
> > >
> > >
> > > ________________________________
> > > From: frank_19_88 <frank_19_88@>
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Sunday, April 21, 2013 2:04 PM
> > > Subject: [DynoMotion] Re: Kanalog -> RS232 -> Innomotion PLC
> > >
> > >
> > >
> > > ÃÂ
> > > Hi TK,
> > >
> > > At 'http://www.cncretrofit.nl/Kflop/RS232 - Console.txt' you can see the console information
> > > At 'http://www.cncretrofit.nl/Kflop/RS232 - DRS232 - VP_ communication Protocol.doc' you can find the communication protocol of the PLC. (I have 8 inputs and 6 outputs on de PLC, and an IO board with 8 inputs and 8 outputs)
> > > At 'http://www.cncretrofit.nl/Kflop/ModbusMasterVer1.c' you will find the new .c file
> > >
> > > Or: 'http://www.cncretrofit.nl/Kflop/kflop.rar'
> > > Or: 'http://www.hoefon.nl/kflop/kflop.rar'
> > >
> > > I did add the flag, the program doesn't crash any more.
> > >
> > > The documentation of the PLC say:
> > > Command code 17: 3A;01;11;EE
> > > Heading :3A
> > > Slave address :01
> > > command code :11
> > > error check (LRC) :EE
> > >
> > > Command code 01: 3A;01;01;04;00;00;08;BF;CR;LF
> > > Command code 15: 0F;05;00;00;06;01;3F;11;CR;LF
> > > ( I think CR;LF is strange because it is not hexadecimal )
> > >
> > > I hope you can open de documents.
> > > Maybe I have the wrong communication settings?
> > >
> > > 1. Communication Interface: RS-232C
> > > 2. Communication Protocol ASCII mode, 9600(Baud rate),7(Data length), EVEN(Parity),1(Stop bit)
> > > 3. Communication Data Frame
> > > STX Start character `:'(3AH)
> > > ADR 1 Communication address:
> > > ADR 0 8-bit address consists of 2 ASCII codes
> > > CMD 1 Command code:
> > > CMD 0 8-bit command consists of 2 ASCII codes
> > > DATA(0) Contents of data:
> > > DATA(1) n8-bit data consist of 2n ASCII codes.
> > > ââ¬Â¦Ã¢â¬Â¦Ã¢â¬Â¦. n37, maximum of 74 ASCII codes
> > > DATA(n-1)
> > > LRC CHK 1 LRC check sum:
> > > LRC CHK 0 8-bit check sum consists of 2 ASCII codes
> > > END 1 End character:
> > > END 0 END 1 = CR(0DH),END 0 = LF(0AH)
> > >
> > > With kind regards,
> > >
> > > Frank
> > >
> > > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > >
> > > > Hi Frank,
> > > >
> > > > It looks like you commented out the end flag in the MonitorList Table which is likely to cause the program to crash.
> > > >
> > > > change
> > > >
> > > > //{0,0,0} // end flag
> > > >
> > > > to
> > > >
> > > > {0,0,0} // end flag
> > > >
> > > > Your links to cncretrofit.nl don't work for me.
> > > >
> > > >
> > > > Also notice in the example there are 8 things for each entry in the table (6 characters and 2 numbers) as described in the comment
> > > >
> > > >
> > > > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added as necessary.
> > > > //{"\x01\x04\xE0\x00\x00\x01", 6, 0}, // Read inputs to MBRegisters[0]
> > > >
> > > > you changed to 6 things??Ãâà(4 characters and 2 numbers):
> > > >
> > > > {"\x3A\x01\x11\xEE", 4, 0}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > >
> > > >
> > > >
> > > > Similarly the changes to the other table don't fit the required format.
> > > >
> > > >
> > > > I would also remove everything in the Connect list as it is not really needed to read the diagnostic information (but leave the end flag)
> > > >
> > > >
> > > >
> > > > Regards
> > > > TK
> > > >
> > > >
> > > >
> > > > ________________________________
> > > > From: frank_19_88 <frank_19_88@>
> > > > To: DynoMotion@yahoogroups.com
> > > > Sent: Sunday, April 21, 2013 10:22 AM
> > > > Subject: [DynoMotion] Kanalog -> RS232 -> Innomotion PLC
> > > >
> > > >
> > > >
> > > > ÃâÃÂ
> > > > Hey TK,
> > > >
> > > > At the moment I started the rs232 project.
> > > >
> > > > I am using KMotion430f.exe (Kflop + Kanalog)
> > > > And did buy this plc: http://www.innomotion.eu/plc/dvp-ss2.html
> > > > And connected Kanalog rs232 to the plc (Connected the transfer bit from the Kanalog to the receive bit of the PLC and receive to transfer and ground to ground)
> > > >
> > > > I did change your ModbusMasterVer1.c:
> > > > ModbusMaster_Cmds ModbusMaster_ConnectList[] =
> > > > {
> > > > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added.
> > > > //{"\x01\x04\xF0\x00\x00\x10", 6, 2}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > > {"\x3A\x01\x11\xEE", 4, 0}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > > {0,0,0} // end flag
> > > > };
> > > >
> > > > ModbusMaster_Cmds ModbusMaster_MonitorList[] =
> > > > {
> > > > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added as necessary.
> > > > //{"\x01\x04\xE0\x00\x00\x01", 6, 0}, // Read inputs to MBRegisters[0]
> > > > //{"\x01\x10\xE2\x00\x00\x01", 6, 1}, // Write outputs from MBRegisters[1]
> > > > {"\3A\x01\x01\x04\x00\x00\x08\xBF", 8, 0}, // Read inputs to MBRegisters[0]
> > > > {"\x0F\x05\x00\x00\x06\x02\xCD\x01\x11", 9, 1}, // Write outputs from MBRegisters[1]
> > > > //{0,0,0} // end flag
> > > > };
> > > > And changed baud rate to 9600.
> > > >
> > > > But when I run the code it gives me an error 'Read failed - Auto disconnect'
> > > > At 'www.cncretrofit.nl/Kflop/RS232 - Console.txt' you can see the console information
> > > > At 'www.cncretrofit.nl/Kflop/RS232 - DRS232 - VP_ communication Protocol.doc' you can find the communication protocol of the PLC. (I have 8 inputs and 6 outputs on de PLC, and an IO board with 8 inputs and 8 outputs)
> > > > At 'www.cncretrofit.nl/Kflop/ModbusMasterVer1.c' you will find the new .c file
> > > >
> > > > Command code 17: {"\x3A\x01\x11\xEE", 4, 0}
> > > > Command code 01: {"\3A\x01\x01\x04\x00\x00\x08\xBF\xCR\xLF", 10, 0}, // 04 "X" are inputs, Read inputs to MBRegisters[0]
> > > > Command code 15: {"\x0F\x05\x00\x00\x06\x02\xCD\x01\x11\xCR\xLF", 11, 0}, // 05 "Y" are outputs Write outputs from MBRegisters[1]
> > > >
> > > > Can you/I write an C program to send 3A:01:11:EE to the PLC? And read the answer to check the connection?
> > > > After that we can try to read/write the PLC.
> > > >
> > > > Thank you,
> > > >
> > > > Frank
> > > >
> > >
> >
>
|
|
Group: DynoMotion |
Message: 7346 |
From: TK |
Date: 4/27/2013 |
Subject: Re: Kanalog -> RS232 -> Innomotion PLC |
Hi Frank,
You will need to write a small function from scratch to do the 8-bit checksum according to the formula in the document for your PLC. You can't just write out half of the 16-bit CRC value. They are completely different algorithms.
Yes the Kanalog RS232 port has been tested.
Use the latest Test Version 4.31c
Regards TK
HI TK,
I changed it to:
int csum=CRC16(ModbusMaster_packetBuild,chp-ModbusMaster_packetBuild);
*chp++=csum&0xFF;
//*chp++=(csum>>8)&0xFF;
(CRC8, didn't work)
Console changed from "Tx:01;10;05;00;00;01;02;00;3f;b3;40;" to "Tx:01;10;05;00;00;01;02;00;3f;b3;" but still no connection.
Did you test the rs232 connection of the kanalog? (half year ago you said you didn't)
Do I need to upgrade version "430f"?
If you want to try it for your self you can login true Teamviewer or remote desktop.
Or do you have any other suggestions?
With kind regards,
Frank
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Frank,
>
> Here is where the 16-bit CRC code is added in:
>
> int csum=CRC16(ModbusMaster_packetBuild,chp-ModbusMaster_packetBuild);
> *chp++=csum&0xFF;
> *chp++=(csum>>8)&0xFF;
>
>
> You would need to change that to do the simple 8-bit sum.
>
> Regards
> TK
>
>
>
> ________________________________
> From: frank_19_88 <frank_19_88@...>
> To: DynoMotion@yahoogroups.com
> Sent: Saturday, April 27, 2013 11:13 AM
> Subject: [DynoMotion] Re: Kanalog -> RS232 -> Innomotion PLC
>
>
>
>
> Hi TK,
>
> (Also see my message from yesterday)
>
> Today I did change baud rate from kflop back to 38400 at the .c file.
> I think the modbus commands are very similar, Innomotion PLC also support this
> command:
> {"\x01\x10\x05\x00\x00\x01", 6, 1}, // Write outputs
> "x05" instead of "xE2" because the outputs are at and different address.
> At the console I receive:
> "Tx:01;10;05;00;00;01;02;00;3f;b3;40;"
> I think the problem is at the Error Check (LRC) kflop sends 2 byte's and the PLC
> document says 1 byte.
>
> "3f" changed :) when 56-61 change :)
> Maybe useful:
> http://www.kavrammuhendislik.com.tr/dokumanlar/DELTA_DVP-ES2_SS2_SA2_SX2-Program_O_EN_20110302.pdf
>
> Hope you have any idea how to fix it.
>
> Frank
>
> --- In DynoMotion@yahoogroups.com, "frank_19_88" <frank_19_88@> wrote:
> >
> > Hi TK,
> >
> > I changed the PLC settings from "9600,7,even,1" To "Baud:38400, 8 Bits, None, 1 stop bit".
> >
> > But I don't know how I can send "\x01\x10\xE2\x00\x00\x01" with teraterm. (Also tried realterm)
> >
> > I am enable to change the PLC outputs with the PC software "delta soft: ISPSoft V1.03" (true rs232) but I can't monitor the com port at that time.
> >
> > With kind regards,
> >
> > Frank
> >
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi Frank,
> > >
> > >
> > > I was able to download the .rar file only.
> > >
> > > Like I said previously I would make the connnect List empty to simplify things as that was just intended to read version info and such from the PLC. so delete   Â
> > >
> > >
> > > {"\x3A\x01\x11\xEE", 4, 0},   // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > >
> > > Also use:
> > >
> > > Â Â Â EnableRS232Cmds(RS232_BAUD_9600);
> > >
> > >
> > > for 9600 baud.
> > >
> > > The PLC document talks about 7bits even parity. KFLOP only does 8 bits no parity (although it would be possible to add parity in software), but the hex command examples seem to be no parity.
> > >
> > > It isn't clear to me from their documentation if that ":" character or STX or 0x3A is actually needed and sent. I would try removing it.
> > >
> > > The CR and LF are carriage return and line feed characters. But the checksum and those are added automatically.
> > >
> > > You may want to connect your PLC to a PC and user TeraTerm to type characters to test things first.
> > >
> > > Regards
> > > TK
> > >
> > >
> > >
> > >
> > > ________________________________
> > > From: frank_19_88 <frank_19_88@>
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Sunday, April 21, 2013 2:04 PM
> > > Subject: [DynoMotion] Re: Kanalog -> RS232 -> Innomotion PLC
> > >
> > >
> > >
> > > Â
> > > Hi TK,
> > >
> > > At 'http://www.cncretrofit.nl/Kflop/RS232 - Console.txt' you can see the console information
> > > At 'http://www.cncretrofit.nl/Kflop/RS232 - DRS232 - VP_ communication Protocol.doc' you can find the communication protocol of the PLC. (I have 8 inputs and 6 outputs on de PLC, and an IO board with 8 inputs and 8 outputs)
> > > At 'http://www.cncretrofit.nl/Kflop/ModbusMasterVer1.c' you will find the new .c file
> > >
> > > Or: 'http://www.cncretrofit.nl/Kflop/kflop.rar'
> > > Or: 'http://www.hoefon.nl/kflop/kflop.rar'
> > >
> > > I did add the flag, the program doesn't crash any more.
> > >
> > > The documentation of the PLC say:
> > > Command code 17: 3A;01;11;EE
> > > Heading :3A
> > > Slave address :01
> > > command code :11
> > > error check (LRC) :EE
> > >
> > > Command code 01: 3A;01;01;04;00;00;08;BF;CR;LF
> > > Command code 15: 0F;05;00;00;06;01;3F;11;CR;LF
> > > ( I think CR;LF is strange because it is not hexadecimal )
> > >
> > > I hope you can open de documents.
> > > Maybe I have the wrong communication settings?
> > >
> > > 1. Communication Interface: RS-232C
> > > 2. Communication Protocol ASCII mode, 9600(Baud rate),7(Data length), EVEN(Parity),1(Stop bit)
> > > 3. Communication Data Frame
> > > STX Start character `:'(3AH)
> > > ADR 1 Communication address:
> > > ADR 0 8-bit address consists of 2 ASCII codes
> > > CMD 1 Command code:
> > > CMD 0 8-bit command consists of 2 ASCII codes
> > > DATA(0) Contents of data:
> > > DATA(1) n8-bit data consist of 2n ASCII codes.
> > > ………. n37, maximum of 74 ASCII codes
> > > DATA(n-1)
> > > LRC CHK 1 LRC check sum:
> > > LRC CHK 0 8-bit check sum consists of 2 ASCII codes
> > > END 1 End character:
> > > END 0 END 1 = CR(0DH),END 0 = LF(0AH)
> > >
> > > With kind regards,
> > >
> > > Frank
> > >
> > > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > >
> > > > Hi Frank,
> > > >
> > > > It looks like you commented out the end flag in the MonitorList Table which is likely to cause the program to crash.
> > > >
> > > > change
> > > >
> > > > //{0,0,0} // end flag
> > > >
> > > > to
> > > >
> > > > {0,0,0} // end flag
> > > >
> > > > Your links to cncretrofit.nl don't work for me.
> > > >
> > > >
> > > > Also notice in the example there are 8 things for each entry in the table (6 characters and 2 numbers) as described in the comment
> > > >
> > > >
> > > > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added as necessary.
> > > > //{"\x01\x04\xE0\x00\x00\x01", 6, 0}, // Read inputs to MBRegisters[0]
> > > >
> > > > you changed to 6 things?? (4 characters and 2 numbers):
> > > >
> > > > {"\x3A\x01\x11\xEE", 4, 0}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > >
> > > >
> > > >
> > > > Similarly the changes to the other table don't fit the required format.
> > > >
> > > >
> > > > I would also remove everything in the Connect list as it is not really needed to read the diagnostic information (but leave the end flag)
> > > >
> > > >
> > > >
> > > > Regards
> > > > TK
> > > >
> > > >
> > > >
> > > > ________________________________
> > > > From: frank_19_88 <frank_19_88@>
> > > > To: DynoMotion@yahoogroups.com
> > > > Sent: Sunday, April 21, 2013 10:22 AM
> > > > Subject: [DynoMotion] Kanalog -> RS232 -> Innomotion PLC
> > > >
> > > >
> > > >
> > > > ÂÂ
> > > > Hey TK,
> > > >
> > > > At the moment I started the rs232 project.
> > > >
> > > > I am using KMotion430f.exe (Kflop + Kanalog)
> > > > And did buy this plc: http://www.innomotion.eu/plc/dvp-ss2.html
> > > > And connected Kanalog rs232 to the plc (Connected the transfer bit from the Kanalog to the receive bit of the PLC and receive to transfer and ground to ground)
> > > >
> > > > I did change your ModbusMasterVer1.c:
> > > > ModbusMaster_Cmds ModbusMaster_ConnectList[] =
> > > > {
> > > > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added.
> > > > //{"\x01\x04\xF0\x00\x00\x10", 6, 2}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > > {"\x3A\x01\x11\xEE", 4, 0}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > > {0,0,0} // end flag
> > > > };
> > > >
> > > > ModbusMaster_Cmds ModbusMaster_MonitorList[] =
> > > > {
> > > > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added as necessary.
> > > > //{"\x01\x04\xE0\x00\x00\x01", 6, 0}, // Read inputs to MBRegisters[0]
> > > > //{"\x01\x10\xE2\x00\x00\x01", 6, 1}, // Write outputs from MBRegisters[1]
> > > > {"\3A\x01\x01\x04\x00\x00\x08\xBF", 8, 0}, // Read inputs to MBRegisters[0]
> > > > {"\x0F\x05\x00\x00\x06\x02\xCD\x01\x11", 9, 1}, // Write outputs from MBRegisters[1]
> > > > //{0,0,0} // end flag
> > > > };
> > > > And changed baud rate to 9600.
> > > >
> > > > But when I run the code it gives me an error 'Read failed - Auto disconnect'
> > > > At 'www.cncretrofit.nl/Kflop/RS232 - Console.txt' you can see the console information
> > > > At 'www.cncretrofit.nl/Kflop/RS232 - DRS232 - VP_ communication Protocol.doc' you can find the communication protocol of the PLC. (I have 8 inputs and 6 outputs on de PLC, and an IO board with 8 inputs and 8 outputs)
> > > > At 'www.cncretrofit.nl/Kflop/ModbusMasterVer1.c' you will find the new .c file
> > > >
> > > > Command code 17: {"\x3A\x01\x11\xEE", 4, 0}
> > > > Command code 01: {"\3A\x01\x01\x04\x00\x00\x08\xBF\xCR\xLF", 10, 0}, // 04 "X" are inputs, Read inputs to MBRegisters[0]
> > > > Command code 15: {"\x0F\x05\x00\x00\x06\x02\xCD\x01\x11\xCR\xLF", 11, 0}, // 05 "Y" are outputs Write outputs from MBRegisters[1]
> > > >
> > > > Can you/I write an C program to send 3A:01:11:EE to the PLC? And read the answer to check the connection?
> > > > After that we can try to read/write the PLC.
> > > >
> > > > Thank you,
> > > >
> > > > Frank
> > > >
> > >
|
|
Group: DynoMotion |
Message: 7347 |
From: frank_19_88 |
Date: 4/28/2013 |
Subject: Re: Kanalog -> RS232 -> Innomotion PLC |
Hi TK,
Good to hear that the RS232 port has been tested.
I did change the PLC CRC Checksum setting to 16 bit.
Also set PLC settings from ASCII to RTU mode because you talked about CRC. (CRC is used for RTU mode, LRC is used for ASCII mode)
And I installed the latest version 4.31c. (Version change did not change console result)
I found this about the PLC:
Source: http://www.kavrammuhendislik.com.tr/dokumanlar/DELTA_DVP-ES2_SS2_SA2_SX2-Program_O_EN_20110302.pdf
Page: 560
Console after I changed to RTU:
"
Modbus Master Init
List:0 ConnectIndex:0 MonitorIndex:0
ModbusMaster_Send: Tried to execute at end list
Unexpected default: ModbusMaster_Send(), Function -112
ModbusMaster_Retry:1
List:0 ConnectIndex:0 MonitorIndex:0
ModbusMaster_Send: Tried to execute at end list
Tx:01;04;04;00;00;01;30;fa;
Unexpected default: Process_Data(), Buffer[1]=132
List:0 ConnectIndex:2 MonitorIndex:0
Unexpected default: Process_Data(), Buffer[1]=144
Unexpected default: Process_Data(), Buffer[1]=132
Unexpected default: Process_Data(), Buffer[1]=144
Unexpected default: Process_Data(), Buffer[1]=132
"
After that it repeatedly prints "Unexpected default: Process_Data(), Buffer[1]=132/144"
When I disconnect the rs232 cable:
"
Unexpected default: Process_Data(), Buffer[1]=132
ModbusMaster_Retry:1
Tx:01;10;05;00;00;01;02;00;20;f2;88;
Seconds: 10
ModbusMaster_MonitorCycleTime=0.014936 (66.950268/s)
ModbusMaster_TallyCommands/s=110
ModbusMaster_TallyConnections=1
ModbusMaster_TallyRetries=2
ModbusMaster_Retry:2
Tx:01;10;05;00;00;01;02;00;20;f2;88;
Modbus Master Init
List:0 ConnectIndex:0 MonitorIndex:0
ModbusMaster_Send: Tried to execute at end list
ModbusMaster_Retry:1
List:0 ConnectIndex:0 MonitorIndex:0
ModbusMaster_Send: Tried to execute at end list
Tx:01;04;04;00;00;01;30;fa;
ModbusMaster_Retry:2
List:0 ConnectIndex:1 MonitorIndex:0
Tx:01;04;04;00;00;01;30;fa;
"
I changed the .c code as the PLC document tells:
"
unsigned short CRC16(unsigned char *puchMsg,unsigned char usDataLen)
{
int j;
unsigned int reg_crc=0Xffff;
while(usDataLen--)
{
reg_crc ^= *puchMsg++;
for (j=0;j<8;j++)
{
if (reg_crc & 0x01) reg_crc=(reg_crc>>1) ^ 0Xa001; /* LSB(b0)=1 */
else reg_crc=reg_crc >>1;
}
}
return reg_crc;
// the value that sent back to the CRC register finally
}
//unsigned short CRC16(unsigned char *puchMsg,unsigned short usDataLen)
// {
// unsigned char uchCRCHi = 0xff;
// unsigned char uchCRCLo = 0xff;
// unsigned int uIndex;
// while(usDataLen--)
// {
// uIndex = uchCRCLo ^ *puchMsg++;
// uchCRCLo = uchCRCHi ^ auchCRCHi[uIndex];
// uchCRCHi = auchCRCLo[uIndex];
// }
// return (uchCRCHi<<8|uchCRCLo);
// }
"
But same result.
I think we made process because the console changes after disconnecting the cable.
Maybe the PLC answer cant be read with the kfop .c code?
Ps. Kflop bit 48-55 and PLC output status don't change after running the .c code.
Your ModbusMasterVer1.c sample has one line "double ModbusMaster_EndOfPacketWait=3.5*10/9600; // wait 3.5 characters after a packet 9600=baud rate)" do I have to change it to "38400" ??
With kind regards,
Frank
--- In DynoMotion@yahoogroups.com, TK <tk@...> wrote:
>
> Hi Frank,
>
> You will need to write a small function from scratch to do the 8-bit checksum according to the formula in the document for your PLC. You can't just write out half of the 16-bit CRC value. They are completely different algorithms.
>
> Yes the Kanalog RS232 port has been tested.
>
> Use the latest Test Version 4.31c
>
> Regards
> TK
>
> On Apr 27, 2013, at 5:30 PM, "frank_19_88" <frank_19_88@...> wrote:
>
> > HI TK,
> >
> > I changed it to:
> > int csum=CRC16(ModbusMaster_packetBuild,chp-ModbusMaster_packetBuild);
> > *chp++=csum&0xFF;
> > //*chp++=(csum>>8)&0xFF;
> > (CRC8, didn't work)
> >
> > Console changed from "Tx:01;10;05;00;00;01;02;00;3f;b3;40;" to "Tx:01;10;05;00;00;01;02;00;3f;b3;" but still no connection.
> >
> > Did you test the rs232 connection of the kanalog? (half year ago you said you didn't)
> > Do I need to upgrade version "430f"?
> >
> > If you want to try it for your self you can login true Teamviewer or remote desktop.
> >
> > Or do you have any other suggestions?
> >
> > With kind regards,
> >
> > Frank
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi Frank,
> > >
> > > Here is where the 16-bit CRC code is added in:
> > >
> > > int csum=CRC16(ModbusMaster_packetBuild,chp-ModbusMaster_packetBuild);
> > > *chp++=csum&0xFF;
> > > *chp++=(csum>>8)&0xFF;
> > >
> > >
> > > You would need to change that to do the simple 8-bit sum.
> > >
> > > Regards
> > > TK
> > >
> > >
> > >
> > > ________________________________
> > > From: frank_19_88 <frank_19_88@>
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Saturday, April 27, 2013 11:13 AM
> > > Subject: [DynoMotion] Re: Kanalog -> RS232 -> Innomotion PLC
> > >
> > >
> > >
> > >
> > > Hi TK,
> > >
> > > (Also see my message from yesterday)
> > >
> > > Today I did change baud rate from kflop back to 38400 at the .c file.
> > > I think the modbus commands are very similar, Innomotion PLC also support this
> > > command:
> > > {"\x01\x10\x05\x00\x00\x01", 6, 1}, // Write outputs
> > > "x05" instead of "xE2" because the outputs are at and different address.
> > > At the console I receive:
> > > "Tx:01;10;05;00;00;01;02;00;3f;b3;40;"
> > > I think the problem is at the Error Check (LRC) kflop sends 2 byte's and the PLC
> > > document says 1 byte.
> > >
> > > "3f" changed :) when 56-61 change :)
> > > Maybe useful:
> > > http://www.kavrammuhendislik.com.tr/dokumanlar/DELTA_DVP-ES2_SS2_SA2_SX2-Program_O_EN_20110302.pdf
> > >
> > > Hope you have any idea how to fix it.
> > >
> > > Frank
> > >
> > > --- In DynoMotion@yahoogroups.com, "frank_19_88" <frank_19_88@> wrote:
> > > >
> > > > Hi TK,
> > > >
> > > > I changed the PLC settings from "9600,7,even,1" To "Baud:38400, 8 Bits, None, 1 stop bit".
> > > >
> > > > But I don't know how I can send "\x01\x10\xE2\x00\x00\x01" with teraterm. (Also tried realterm)
> > > >
> > > > I am enable to change the PLC outputs with the PC software "delta soft: ISPSoft V1.03" (true rs232) but I can't monitor the com port at that time.
> > > >
> > > > With kind regards,
> > > >
> > > > Frank
> > > >
> > > >
> > > > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > > >
> > > > > Hi Frank,
> > > > >
> > > > >
> > > > > I was able to download the .rar file only.
> > > > >
> > > > > Like I said previously I would make the connnect List empty to simplify things as that was just intended to read version info and such from the PLC.à so delete à à Ã
> > > > >
> > > > >
> > > > > {"\x3A\x01\x11\xEE", 4, 0},Ã Ã Ã // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > > >
> > > > > Also use:
> > > > >
> > > > > Ã Ã Ã EnableRS232Cmds(RS232_BAUD_9600);
> > > > >
> > > > >
> > > > > for 9600 baud.
> > > > >
> > > > > The PLC document talks about 7bits even parity.Ã KFLOP only does 8 bits no parity (although it would be possible to add parity in software), but the hex command examples seem to be no parity.
> > > > >
> > > > > It isn't clear to me from their documentation if that ":" character or STX or 0x3A is actually needed and sent.Ã I would try removing it.
> > > > >
> > > > > The CR and LF are carriage return and line feed characters.Ã But the checksum and those are added automatically.
> > > > >
> > > > > You may want to connect your PLC to a PC and user TeraTerm to type characters to test things first.
> > > > >
> > > > > Regards
> > > > > TK
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > ________________________________
> > > > > From: frank_19_88 <frank_19_88@>
> > > > > To: DynoMotion@yahoogroups.com
> > > > > Sent: Sunday, April 21, 2013 2:04 PM
> > > > > Subject: [DynoMotion] Re: Kanalog -> RS232 -> Innomotion PLC
> > > > >
> > > > >
> > > > >
> > > > > Ã
> > > > > Hi TK,
> > > > >
> > > > > At 'http://www.cncretrofit.nl/Kflop/RS232 - Console.txt' you can see the console information
> > > > > At 'http://www.cncretrofit.nl/Kflop/RS232 - DRS232 - VP_ communication Protocol.doc' you can find the communication protocol of the PLC. (I have 8 inputs and 6 outputs on de PLC, and an IO board with 8 inputs and 8 outputs)
> > > > > At 'http://www.cncretrofit.nl/Kflop/ModbusMasterVer1.c' you will find the new .c file
> > > > >
> > > > > Or: 'http://www.cncretrofit.nl/Kflop/kflop.rar'
> > > > > Or: 'http://www.hoefon.nl/kflop/kflop.rar'
> > > > >
> > > > > I did add the flag, the program doesn't crash any more.
> > > > >
> > > > > The documentation of the PLC say:
> > > > > Command code 17: 3A;01;11;EE
> > > > > Heading :3A
> > > > > Slave address :01
> > > > > command code :11
> > > > > error check (LRC) :EE
> > > > >
> > > > > Command code 01: 3A;01;01;04;00;00;08;BF;CR;LF
> > > > > Command code 15: 0F;05;00;00;06;01;3F;11;CR;LF
> > > > > ( I think CR;LF is strange because it is not hexadecimal )
> > > > >
> > > > > I hope you can open de documents.
> > > > > Maybe I have the wrong communication settings?
> > > > >
> > > > > 1. Communication Interface: RS-232C
> > > > > 2. Communication Protocol ASCII mode, 9600(Baud rate),7(Data length), EVEN(Parity),1(Stop bit)
> > > > > 3. Communication Data Frame
> > > > > STX Start character `:'(3AH)
> > > > > ADR 1 Communication address:
> > > > > ADR 0 8-bit address consists of 2 ASCII codes
> > > > > CMD 1 Command code:
> > > > > CMD 0 8-bit command consists of 2 ASCII codes
> > > > > DATA(0) Contents of data:
> > > > > DATA(1) n8-bit data consist of 2n ASCII codes.
> > > > > ââ¬Â¦Ã¢â¬Â¦Ã¢â¬Â¦. n37, maximum of 74 ASCII codes
> > > > > DATA(n-1)
> > > > > LRC CHK 1 LRC check sum:
> > > > > LRC CHK 0 8-bit check sum consists of 2 ASCII codes
> > > > > END 1 End character:
> > > > > END 0 END 1 = CR(0DH),END 0 = LF(0AH)
> > > > >
> > > > > With kind regards,
> > > > >
> > > > > Frank
> > > > >
> > > > > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > > > >
> > > > > > Hi Frank,
> > > > > >
> > > > > > It looks like you commented out the end flag in the MonitorList Table which is likely to cause the program to crash.
> > > > > >
> > > > > > change
> > > > > >
> > > > > > //{0,0,0} // end flag
> > > > > >
> > > > > > to
> > > > > >
> > > > > > {0,0,0} // end flag
> > > > > >
> > > > > > Your links to cncretrofit.nl don't work for me.
> > > > > >
> > > > > >
> > > > > > Also notice in the example there are 8 things for each entry in the table (6 characters and 2 numbers) as described in the comment
> > > > > >
> > > > > >
> > > > > > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added as necessary.
> > > > > > //{"\x01\x04\xE0\x00\x00\x01", 6, 0}, // Read inputs to MBRegisters[0]
> > > > > >
> > > > > > you changed to 6 things??Ãâà (4 characters and 2 numbers):
> > > > > >
> > > > > > {"\x3A\x01\x11\xEE", 4, 0}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > > > >
> > > > > >
> > > > > >
> > > > > > Similarly the changes to the other table don't fit the required format.
> > > > > >
> > > > > >
> > > > > > I would also remove everything in the Connect list as it is not really needed to read the diagnostic information (but leave the end flag)
> > > > > >
> > > > > >
> > > > > >
> > > > > > Regards
> > > > > > TK
> > > > > >
> > > > > >
> > > > > >
> > > > > > ________________________________
> > > > > > From: frank_19_88 <frank_19_88@>
> > > > > > To: DynoMotion@yahoogroups.com
> > > > > > Sent: Sunday, April 21, 2013 10:22 AM
> > > > > > Subject: [DynoMotion] Kanalog -> RS232 -> Innomotion PLC
> > > > > >
> > > > > >
> > > > > >
> > > > > > ÃâÃ
> > > > > > Hey TK,
> > > > > >
> > > > > > At the moment I started the rs232 project.
> > > > > >
> > > > > > I am using KMotion430f.exe (Kflop + Kanalog)
> > > > > > And did buy this plc: http://www.innomotion.eu/plc/dvp-ss2.html
> > > > > > And connected Kanalog rs232 to the plc (Connected the transfer bit from the Kanalog to the receive bit of the PLC and receive to transfer and ground to ground)
> > > > > >
> > > > > > I did change your ModbusMasterVer1.c:
> > > > > > ModbusMaster_Cmds ModbusMaster_ConnectList[] =
> > > > > > {
> > > > > > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added.
> > > > > > //{"\x01\x04\xF0\x00\x00\x10", 6, 2}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > > > > {"\x3A\x01\x11\xEE", 4, 0}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > > > > {0,0,0} // end flag
> > > > > > };
> > > > > >
> > > > > > ModbusMaster_Cmds ModbusMaster_MonitorList[] =
> > > > > > {
> > > > > > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added as necessary.
> > > > > > //{"\x01\x04\xE0\x00\x00\x01", 6, 0}, // Read inputs to MBRegisters[0]
> > > > > > //{"\x01\x10\xE2\x00\x00\x01", 6, 1}, // Write outputs from MBRegisters[1]
> > > > > > {"\3A\x01\x01\x04\x00\x00\x08\xBF", 8, 0}, // Read inputs to MBRegisters[0]
> > > > > > {"\x0F\x05\x00\x00\x06\x02\xCD\x01\x11", 9, 1}, // Write outputs from MBRegisters[1]
> > > > > > //{0,0,0} // end flag
> > > > > > };
> > > > > > And changed baud rate to 9600.
> > > > > >
> > > > > > But when I run the code it gives me an error 'Read failed - Auto disconnect'
> > > > > > At 'www.cncretrofit.nl/Kflop/RS232 - Console.txt' you can see the console information
> > > > > > At 'www.cncretrofit.nl/Kflop/RS232 - DRS232 - VP_ communication Protocol.doc' you can find the communication protocol of the PLC. (I have 8 inputs and 6 outputs on de PLC, and an IO board with 8 inputs and 8 outputs)
> > > > > > At 'www.cncretrofit.nl/Kflop/ModbusMasterVer1.c' you will find the new .c file
> > > > > >
> > > > > > Command code 17: {"\x3A\x01\x11\xEE", 4, 0}
> > > > > > Command code 01: {"\3A\x01\x01\x04\x00\x00\x08\xBF\xCR\xLF", 10, 0}, // 04 "X" are inputs, Read inputs to MBRegisters[0]
> > > > > > Command code 15: {"\x0F\x05\x00\x00\x06\x02\xCD\x01\x11\xCR\xLF", 11, 0}, // 05 "Y" are outputs Write outputs from MBRegisters[1]
> > > > > >
> > > > > > Can you/I write an C program to send 3A:01:11:EE to the PLC? And read the answer to check the connection?
> > > > > > After that we can try to read/write the PLC.
> > > > > >
> > > > > > Thank you,
> > > > > >
> > > > > > Frank
> > > > > >
> > > > >
>
|
|
Group: DynoMotion |
Message: 7353 |
From: Tom Kerekes |
Date: 4/28/2013 |
Subject: Re: Kanalog -> RS232 -> Innomotion PLC |
Hi Frank,
Yes I think RTU mode is more like the code is expecting.
I think our original 16-bit CRC calculation would probably work. It is just using those
tables to do it much faster than the bit-by-bit like described in the document.
I didn't realize the code prints a message if the connect list is empty. But that should not be a problem. Just ignore the message on the console that says:
ModbusMaster_Send: Tried to execute at end list
But the next error is:
Unexpected default: ModbusMaster_Send(), Function -112
This means you changed the table to have an invalid ModBus command. Only 0x03, 0x04, and 0x10 are supported.
You did not attach the code you are using.
Yes change:
double ModbusMaster_EndOfPacketWait=3.5*10/9600
for whatever baud rate you are using.
The PLC must be set for no parity and 1 stop bit.
Regards TK
Group: DynoMotion |
Message: 7361 |
From: frank_19_88 |
Date: 4/28/2013 |
Subject: Re: Kanalog -> RS232 -> Innomotion PLC |
Hi TK,
I am enable to use this commands:
{"\x01\x03\x10\x00\x00\x02", 6, 0}, // Read inputs to MBRegisters[0]
{"\x01\x10\x10\x02\x00\x02", 6, 1}, // Write outputs from MBRegisters[1]
(Before I was writing the outputs, now I am writing registers and copy those to the outputs with the PLC)
I can read 8 inputs and write 8 outputs.
Is it possible to expand this to 16 or even better to 32?
With kind regards,
Frank
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Frank,
>
> Yes I think RTU mode is more like the code is expecting.
>
> I think our original 16-bit CRC calculation would probably work. It is just using those tables to do it much faster than the bit-by-bit like described in the document.
>
> I didn't realize the code prints a message if the connect list is empty. But that should not be a problem. Just ignore the message on the console that says:
>
>
> Â Â Â Â Â Â Â ModbusMaster_Send: Tried to execute at end list
>
>
> But the next error is:
>
> Â Â Â Â Â Â Â Unexpected default: ModbusMaster_Send(), Function -112
>
> This means you changed the table to have an invalid ModBus command. Only 0x03, 0x04, and 0x10 are supported.
>
> You did not attach the code you are using.
>
> Yes change:
>
> double ModbusMaster_EndOfPacketWait=3.5*10/9600
>
> for whatever baud rate you are using.
>
> The PLC must be set for no parity and 1 stop bit.
>
> Regards
> TK
>
>
>
>
> ________________________________
> From: frank_19_88 <frank_19_88@...>
> To: DynoMotion@yahoogroups.com
> Sent: Sunday, April 28, 2013 8:12 AM
> Subject: [DynoMotion] Re: Kanalog -> RS232 -> Innomotion PLC
>
>
>
> Â
> Hi TK,
>
> Good to hear that the RS232 port has been tested.
>
> I did change the PLC CRC Checksum setting to 16 bit.
> Also set PLC settings from ASCII to RTU mode because you talked about CRC. (CRC is used for RTU mode, LRC is used for ASCII mode)
> And I installed the latest version 4.31c. (Version change did not change console result)
>
> I found this about the PLC:
> Source: http://www.kavrammuhendislik.com.tr/dokumanlar/DELTA_DVP-ES2_SS2_SA2_SX2-Program_O_EN_20110302.pdf
> Page: 560
>
> Console after I changed to RTU:
> "
> Modbus Master Init
> List:0 ConnectIndex:0 MonitorIndex:0
> ModbusMaster_Send: Tried to execute at end list
> Unexpected default: ModbusMaster_Send(), Function -112
> ModbusMaster_Retry:1
> List:0 ConnectIndex:0 MonitorIndex:0
> ModbusMaster_Send: Tried to execute at end list
> Tx:01;04;04;00;00;01;30;fa;
> Unexpected default: Process_Data(), Buffer[1]=132
> List:0 ConnectIndex:2 MonitorIndex:0
> Unexpected default: Process_Data(), Buffer[1]=144
> Unexpected default: Process_Data(), Buffer[1]=132
> Unexpected default: Process_Data(), Buffer[1]=144
> Unexpected default: Process_Data(), Buffer[1]=132
> "
> After that it repeatedly prints "Unexpected default: Process_Data(), Buffer[1]=132/144"
>
> When I disconnect the rs232 cable:
> "
> Unexpected default: Process_Data(), Buffer[1]=132
> ModbusMaster_Retry:1
> Tx:01;10;05;00;00;01;02;00;20;f2;88;
>
> Seconds: 10
> ModbusMaster_MonitorCycleTime=0.014936 (66.950268/s)
> ModbusMaster_TallyCommands/s=110
> ModbusMaster_TallyConnections=1
> ModbusMaster_TallyRetries=2
> ModbusMaster_Retry:2
> Tx:01;10;05;00;00;01;02;00;20;f2;88;
>
> Modbus Master Init
> List:0 ConnectIndex:0 MonitorIndex:0
> ModbusMaster_Send: Tried to execute at end list
> ModbusMaster_Retry:1
> List:0 ConnectIndex:0 MonitorIndex:0
> ModbusMaster_Send: Tried to execute at end list
> Tx:01;04;04;00;00;01;30;fa;
> ModbusMaster_Retry:2
> List:0 ConnectIndex:1 MonitorIndex:0
> Tx:01;04;04;00;00;01;30;fa;
> "
>
> I changed the .c code as the PLC document tells:
> "
> unsigned short CRC16(unsigned char *puchMsg,unsigned char usDataLen)
> {
> int j;
> unsigned int reg_crc=0Xffff;
> while(usDataLen--)
> {
> reg_crc ^= *puchMsg++;
> for (j=0;j<8;j++)
> {
> if (reg_crc & 0x01) reg_crc=(reg_crc>>1) ^ 0Xa001; /* LSB(b0)=1 */
> else reg_crc=reg_crc >>1;
> }
> }
> return reg_crc;
> // the value that sent back to the CRC register finally
> }
>
> //unsigned short CRC16(unsigned char *puchMsg,unsigned short usDataLen)
> // {
> // unsigned char uchCRCHi = 0xff;
> // unsigned char uchCRCLo = 0xff;
> // unsigned int uIndex;
> // while(usDataLen--)
> // {
> // uIndex = uchCRCLo ^ *puchMsg++;
> // uchCRCLo = uchCRCHi ^ auchCRCHi[uIndex];
> // uchCRCHi = auchCRCLo[uIndex];
> // }
> // return (uchCRCHi<<8|uchCRCLo);
> // }
> "
>
> But same result.
>
> I think we made process because the console changes after disconnecting the cable.
> Maybe the PLC answer cant be read with the kfop .c code?
>
> Ps. Kflop bit 48-55 and PLC output status don't change after running the .c code.
> Your ModbusMasterVer1.c sample has one line "double ModbusMaster_EndOfPacketWait=3.5*10/9600; // wait 3.5 characters after a packet 9600=baud rate)" do I have to change it to "38400" ??
>
> With kind regards,
>
> Frank
>
> --- In DynoMotion@yahoogroups.com, TK <tk@> wrote:
> >
> > Hi Frank,
> >
> > You will need to write a small function from scratch to do the 8-bit checksum according to the formula in the document for your PLC. You can't just write out half of the 16-bit CRC value. They are completely different algorithms.
> >
> > Yes the Kanalog RS232 port has been tested.
> >
> > Use the latest Test Version 4.31c
> >
> > Regards
> > TK
> >
> > On Apr 27, 2013, at 5:30 PM, "frank_19_88" <frank_19_88@> wrote:
> >
> > > HI TK,
> > >
> > > I changed it to:
> > > int csum=CRC16(ModbusMaster_packetBuild,chp-ModbusMaster_packetBuild);
> > > *chp++=csum&0xFF;
> > > //*chp++=(csum>>8)&0xFF;
> > > (CRC8, didn't work)
> > >
> > > Console changed from "Tx:01;10;05;00;00;01;02;00;3f;b3;40;" to "Tx:01;10;05;00;00;01;02;00;3f;b3;" but still no connection.
> > >
> > > Did you test the rs232 connection of the kanalog? (half year ago you said you didn't)
> > > Do I need to upgrade version "430f"?
> > >
> > > If you want to try it for your self you can login true Teamviewer or remote desktop.
> > >
> > > Or do you have any other suggestions?
> > >
> > > With kind regards,
> > >
> > > Frank
> > >
> > > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > >
> > > > Hi Frank,
> > > >
> > > > Here is where the 16-bit CRC code is added in:
> > > >
> > > > int csum=CRC16(ModbusMaster_packetBuild,chp-ModbusMaster_packetBuild);
> > > > *chp++=csum&0xFF;
> > > > *chp++=(csum>>8)&0xFF;
> > > >
> > > >
> > > > You would need to change that to do the simple 8-bit sum.
> > > >
> > > > Regards
> > > > TK
> > > >
> > > >
> > > >
> > > > ________________________________
> > > > From: frank_19_88 <frank_19_88@>
> > > > To: DynoMotion@yahoogroups.com
> > > > Sent: Saturday, April 27, 2013 11:13 AM
> > > > Subject: [DynoMotion] Re: Kanalog -> RS232 -> Innomotion PLC
> > > >
> > > >
> > > >
> > > >
> > > > Hi TK,
> > > >
> > > > (Also see my message from yesterday)
> > > >
> > > > Today I did change baud rate from kflop back to 38400 at the .c file.
> > > > I think the modbus commands are very similar, Innomotion PLC also support this
> > > > command:
> > > > {"\x01\x10\x05\x00\x00\x01", 6, 1}, // Write outputs
> > > > "x05" instead of "xE2" because the outputs are at and different address.
> > > > At the console I receive:
> > > > "Tx:01;10;05;00;00;01;02;00;3f;b3;40;"
> > > > I think the problem is at the Error Check (LRC) kflop sends 2 byte's and the PLC
> > > > document says 1 byte.
> > > >
> > > > "3f" changed :) when 56-61 change :)
> > > > Maybe useful:
> > > > http://www.kavrammuhendislik.com.tr/dokumanlar/DELTA_DVP-ES2_SS2_SA2_SX2-Program_O_EN_20110302.pdf
> > > >
> > > > Hope you have any idea how to fix it.
> > > >
> > > > Frank
> > > >
> > > > --- In DynoMotion@yahoogroups.com, "frank_19_88" <frank_19_88@> wrote:
> > > > >
> > > > > Hi TK,
> > > > >
> > > > > I changed the PLC settings from "9600,7,even,1" To "Baud:38400, 8 Bits, None, 1 stop bit".
> > > > >
> > > > > But I don't know how I can send "\x01\x10\xE2\x00\x00\x01" with teraterm. (Also tried realterm)
> > > > >
> > > > > I am enable to change the PLC outputs with the PC software "delta soft: ISPSoft V1.03" (true rs232) but I can't monitor the com port at that time.
> > > > >
> > > > > With kind regards,
> > > > >
> > > > > Frank
> > > > >
> > > > >
> > > > > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > > > >
> > > > > > Hi Frank,
> > > > > >
> > > > > >
> > > > > > I was able to download the .rar file only.
> > > > > >
> > > > > > Like I said previously I would make the connnect List empty to simplify things as that was just intended to read version info and such from the PLC.Ãâ so delete Ãâ Ãâ Ãâ
> > > > > >
> > > > > >
> > > > > > {"\x3A\x01\x11\xEE", 4, 0},Ãâ Ãâ Ãâ // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > > > >
> > > > > > Also use:
> > > > > >
> > > > > > Ãâ Ãâ Ãâ EnableRS232Cmds(RS232_BAUD_9600);
> > > > > >
> > > > > >
> > > > > > for 9600 baud.
> > > > > >
> > > > > > The PLC document talks about 7bits even parity.Ãâ KFLOP only does 8 bits no parity (although it would be possible to add parity in software), but the hex command examples seem to be no parity.
> > > > > >
> > > > > > It isn't clear to me from their documentation if that ":" character or STX or 0x3A is actually needed and sent.Ãâ I would try removing it.
> > > > > >
> > > > > > The CR and LF are carriage return and line feed characters.Ãâ But the checksum and those are added automatically.
> > > > > >
> > > > > > You may want to connect your PLC to a PC and user TeraTerm to type characters to test things first.
> > > > > >
> > > > > > Regards
> > > > > > TK
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > ________________________________
> > > > > > From: frank_19_88 <frank_19_88@>
> > > > > > To: DynoMotion@yahoogroups.com
> > > > > > Sent: Sunday, April 21, 2013 2:04 PM
> > > > > > Subject: [DynoMotion] Re: Kanalog -> RS232 -> Innomotion PLC
> > > > > >
> > > > > >
> > > > > >
> > > > > > Ãâ
> > > > > > Hi TK,
> > > > > >
> > > > > > At 'http://www.cncretrofit.nl/Kflop/RS232 - Console.txt' you can see the console information
> > > > > > At 'http://www.cncretrofit.nl/Kflop/RS232 - DRS232 - VP_ communication Protocol.doc' you can find the communication protocol of the PLC. (I have 8 inputs and 6 outputs on de PLC, and an IO board with 8 inputs and 8 outputs)
> > > > > > At 'http://www.cncretrofit.nl/Kflop/ModbusMasterVer1.c' you will find the new .c file
> > > > > >
> > > > > > Or: 'http://www.cncretrofit.nl/Kflop/kflop.rar'
> > > > > > Or: 'http://www.hoefon.nl/kflop/kflop.rar'
> > > > > >
> > > > > > I did add the flag, the program doesn't crash any more.
> > > > > >
> > > > > > The documentation of the PLC say:
> > > > > > Command code 17: 3A;01;11;EE
> > > > > > Heading :3A
> > > > > > Slave address :01
> > > > > > command code :11
> > > > > > error check (LRC) :EE
> > > > > >
> > > > > > Command code 01: 3A;01;01;04;00;00;08;BF;CR;LF
> > > > > > Command code 15: 0F;05;00;00;06;01;3F;11;CR;LF
> > > > > > ( I think CR;LF is strange because it is not hexadecimal )
> > > > > >
> > > > > > I hope you can open de documents.
> > > > > > Maybe I have the wrong communication settings?
> > > > > >
> > > > > > 1. Communication Interface: RS-232C
> > > > > > 2. Communication Protocol ASCII mode, 9600(Baud rate),7(Data length), EVEN(Parity),1(Stop bit)
> > > > > > 3. Communication Data Frame
> > > > > > STX Start character `:'(3AH)
> > > > > > ADR 1 Communication address:
> > > > > > ADR 0 8-bit address consists of 2 ASCII codes
> > > > > > CMD 1 Command code:
> > > > > > CMD 0 8-bit command consists of 2 ASCII codes
> > > > > > DATA(0) Contents of data:
> > > > > > DATA(1) n8-bit data consist of 2n ASCII codes.
> > > > > > âââ¬Ã¦Ã¢ââ¬Ã¦Ã¢ââ¬Ã¦. n37, maximum of 74 ASCII codes
> > > > > > DATA(n-1)
> > > > > > LRC CHK 1 LRC check sum:
> > > > > > LRC CHK 0 8-bit check sum consists of 2 ASCII codes
> > > > > > END 1 End character:
> > > > > > END 0 END 1 = CR(0DH),END 0 = LF(0AH)
> > > > > >
> > > > > > With kind regards,
> > > > > >
> > > > > > Frank
> > > > > >
> > > > > > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > > > > >
> > > > > > > Hi Frank,
> > > > > > >
> > > > > > > It looks like you commented out the end flag in the MonitorList Table which is likely to cause the program to crash.
> > > > > > >
> > > > > > > change
> > > > > > >
> > > > > > > //{0,0,0} // end flag
> > > > > > >
> > > > > > > to
> > > > > > >
> > > > > > > {0,0,0} // end flag
> > > > > > >
> > > > > > > Your links to cncretrofit.nl don't work for me.
> > > > > > >
> > > > > > >
> > > > > > > Also notice in the example there are 8 things for each entry in the table (6 characters and 2 numbers) as described in the comment
> > > > > > >
> > > > > > >
> > > > > > > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added as necessary.
> > > > > > > //{"\x01\x04\xE0\x00\x00\x01", 6, 0}, // Read inputs to MBRegisters[0]
> > > > > > >
> > > > > > > you changed to 6 things??ÃÆ'ââ¬Å¡Ãâ (4 characters and 2 numbers):
> > > > > > >
> > > > > > > {"\x3A\x01\x11\xEE", 4, 0}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Similarly the changes to the other table don't fit the required format.
> > > > > > >
> > > > > > >
> > > > > > > I would also remove everything in the Connect list as it is not really needed to read the diagnostic information (but leave the end flag)
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Regards
> > > > > > > TK
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > ________________________________
> > > > > > > From: frank_19_88 <frank_19_88@>
> > > > > > > To: DynoMotion@yahoogroups.com
> > > > > > > Sent: Sunday, April 21, 2013 10:22 AM
> > > > > > > Subject: [DynoMotion] Kanalog -> RS232 -> Innomotion PLC
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > ÃÆ'ââ¬Å¡Ãâ
> > > > > > > Hey TK,
> > > > > > >
> > > > > > > At the moment I started the rs232 project.
> > > > > > >
> > > > > > > I am using KMotion430f.exe (Kflop + Kanalog)
> > > > > > > And did buy this plc: http://www.innomotion.eu/plc/dvp-ss2.html
> > > > > > > And connected Kanalog rs232 to the plc (Connected the transfer bit from the Kanalog to the receive bit of the PLC and receive to transfer and ground to ground)
> > > > > > >
> > > > > > > I did change your ModbusMasterVer1.c:
> > > > > > > ModbusMaster_Cmds ModbusMaster_ConnectList[] =
> > > > > > > {
> > > > > > > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added.
> > > > > > > //{"\x01\x04\xF0\x00\x00\x10", 6, 2}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > > > > > {"\x3A\x01\x11\xEE", 4, 0}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > > > > > {0,0,0} // end flag
> > > > > > > };
> > > > > > >
> > > > > > > ModbusMaster_Cmds ModbusMaster_MonitorList[] =
> > > > > > > {
> > > > > > > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added as necessary.
> > > > > > > //{"\x01\x04\xE0\x00\x00\x01", 6, 0}, // Read inputs to MBRegisters[0]
> > > > > > > //{"\x01\x10\xE2\x00\x00\x01", 6, 1}, // Write outputs from MBRegisters[1]
> > > > > > > {"\3A\x01\x01\x04\x00\x00\x08\xBF", 8, 0}, // Read inputs to MBRegisters[0]
> > > > > > > {"\x0F\x05\x00\x00\x06\x02\xCD\x01\x11", 9, 1}, // Write outputs from MBRegisters[1]
> > > > > > > //{0,0,0} // end flag
> > > > > > > };
> > > > > > > And changed baud rate to 9600.
> > > > > > >
> > > > > > > But when I run the code it gives me an error 'Read failed - Auto disconnect'
> > > > > > > At 'www.cncretrofit.nl/Kflop/RS232 - Console.txt' you can see the console information
> > > > > > > At 'www.cncretrofit.nl/Kflop/RS232 - DRS232 - VP_ communication Protocol.doc' you can find the communication protocol of the PLC. (I have 8 inputs and 6 outputs on de PLC, and an IO board with 8 inputs and 8 outputs)
> > > > > > > At 'www.cncretrofit.nl/Kflop/ModbusMasterVer1.c' you will find the new .c file
> > > > > > >
> > > > > > > Command code 17: {"\x3A\x01\x11\xEE", 4, 0}
> > > > > > > Command code 01: {"\3A\x01\x01\x04\x00\x00\x08\xBF\xCR\xLF", 10, 0}, // 04 "X" are inputs, Read inputs to MBRegisters[0]
> > > > > > > Command code 15: {"\x0F\x05\x00\x00\x06\x02\xCD\x01\x11\xCR\xLF", 11, 0}, // 05 "Y" are outputs Write outputs from MBRegisters[1]
> > > > > > >
> > > > > > > Can you/I write an C program to send 3A:01:11:EE to the PLC? And read the answer to check the connection?
> > > > > > > After that we can try to read/write the PLC.
> > > > > > >
> > > > > > > Thank you,
> > > > > > >
> > > > > > > Frank
> > > > > > >
> > > > > >
> >
>
|
|
Group: DynoMotion |
Message: 7362 |
From: Tom Kerekes |
Date: 4/28/2013 |
Subject: Re: Kanalog -> RS232 -> Innomotion PLC |
Hi Frank,
Progress!!
You have the length set to 2 for both reading and writing. Which should be reading and writing two 16-bit Modbus
registers.
But the KFLOP MBRegisters you are using for reading and writing are overlapping each other.
If you are reading two registers starting at 0 then 0 and 1 are used for reading. So you can not use 1 and 2 for writing.
So change to:
{"\x01\x10\x10\x02\x00\x02", 6, 2}, // Write outputs from MBRegisters[1] and MBRegisters[2]
You must then decide which bits you wish to get/put the information into KFLOP
The original example is for the CLick PLC which just has 8 inputs and 6 outputs so it uses Virtual IO bits 48-63 for those using this code:
// marshal and move values read from PLC/Slave into MBRegisters to KFlop memory void ModbusMaster_RegUnload() { // Move 8 PLC inputs to virtual bits via MBRegisters[0] // Note use SetStateBit which is Atomic and Thread Safe int i; for (i=0; i<8; i++) SetStateBit(48+i,(MBRegisters[0]>>i)&1); // 8 input bits }
// marshal and move values to be sent to PLC/Slave into MBRegisters void ModbusMaster_RegLoad() { // Move 6 virtual bits to PLC outputs via MBRegisters[1] MBRegisters[1] =
(VirtualBits>>8)&0x3F; // the six bits after the 8 input bits }
Where would you like to get/put the data? For example to place 16 inputs at 48-63 use
// marshal and move values read from PLC/Slave into MBRegisters to KFlop memory void ModbusMaster_RegUnload() { // Move 16 PLC inputs to virtual bits via MBRegisters[0] // Note use SetStateBit which is Atomic and Thread
Safe int i; for (i=0; i<16; i++) SetStateBit(48+i,(MBRegisters[0]>>i)&1); // 8 input bits }
And to get 16 outputs from the Extended Virtual bits 1024 - 1039
// marshal and move values to be sent to PLC/Slave into MBRegisters void ModbusMaster_RegLoad() { // Move 16 extended virtual bits to PLC outputs via MBRegisters[1] MBRegisters[2] = (VirtualBitsEx[0])&0xffff; // the 16 bits from bottom of first 32 VirtualBitsEx }
HTH Regards TK
Group: DynoMotion |
Message: 7406 |
From: frank_19_88 |
Date: 5/2/2013 |
Subject: Re: Kanalog -> RS232 -> Innomotion PLC |
Hi TK,
Thank you for your great and fast support!
16 inputs and 16 outputs are working fine!
Only had to change to:
void ModbusMaster_RegUnload()
{
int i;
for (i=0; i<8; i++)
SetStateBit(48+i,(MBRegisters[0]>>i)&1); // 8 input bits
for (i=0; i<8; i++)
SetStateBit(56+i,(MBRegisters[0]>>i)&1); // 8 input bits
}
void ModbusMaster_RegLoad()
{
MBRegisters[2] = (VirtualBitsEx[0])&0xff;
MBRegisters[3] = (VirtualBitsEx[0]+8)&0xff;
}
With kind regards,
Frank
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Frank,
>
> Progress!!
>
> You have the length set to 2 for both reading and writing. Which should be reading and writing two 16-bit Modbus registers.
>
> But the KFLOP MBRegisters you are using for reading and writing are overlapping each other.
>
> If you are reading two registers starting at 0 then 0 and 1 are used for reading. So you can not use 1 and 2 for writing.
>
> So change to:
>
> {"\x01\x10\x10\x02\x00\x02", 6, 2}, // Write outputs from MBRegisters[1] and MBRegisters[2]
>
>
> You must then decide which bits you wish to get/put the information into KFLOP
>
> The original example is for the CLick PLC which just has 8 inputs and 6 outputs so it uses Virtual IO bits 48-63 for those using this code:
>
>
> // marshal and move values read from PLC/Slave into MBRegisters to KFlop memory
> void ModbusMaster_RegUnload()
> {
> Â Â Â // Move 8 PLC inputs to virtual bits via MBRegisters[0]
> Â Â Â // Note use SetStateBit which is Atomic and Thread Safe
> Â Â Â
> Â Â Â int i;
> Â Â Â
> Â Â Â for (i=0; i<8; i++)
> Â Â Â Â Â Â SetStateBit(48+i,(MBRegisters[0]>>i)&1);Â // 8 input bits
> }
>
> // marshal and move values to be sent to PLC/Slave into MBRegisters
> void ModbusMaster_RegLoad()
> {
> Â Â Â // Move 6 virtual bits to PLC outputs via MBRegisters[1]
> Â Â Â MBRegisters[1] = (VirtualBits>>8)&0x3F;Â Â Â // the six bits after the 8 input bits
> }
>
>
> Where would you like to get/put the data? For example to place 16 inputs at 48-63 use
>
>
>
> // marshal and move values read from PLC/Slave into MBRegisters to KFlop memory
> void ModbusMaster_RegUnload()
> {
> Â Â Â // Move 16 PLC inputs to virtual bits via MBRegisters[0]
> Â Â Â // Note use SetStateBit which is Atomic and Thread Safe
> Â Â Â
> Â Â Â int i;
> Â Â Â
> Â Â Â for (i=0; i<16; i++)
> Â Â Â Â Â Â SetStateBit(48+i,(MBRegisters[0]>>i)&1);Â // 8 input bits
> }
>
>
>
> And to get 16 outputs from the Extended Virtual bits 1024 - 1039
>
> // marshal and move values to be sent to PLC/Slave into MBRegisters
> void ModbusMaster_RegLoad()
> {
> Â Â Â // Move 16 extended virtual bits to PLC outputs via MBRegisters[1]
> Â Â Â MBRegisters[2] = (VirtualBitsEx[0])&0xffff;Â Â Â // the 16 bits from bottom of first 32 VirtualBitsEx
> }
>
>
> HTH
> Regards
> TK
>
>
>
> ________________________________
> From: frank_19_88 <frank_19_88@...>
> To: DynoMotion@yahoogroups.com
> Sent: Sunday, April 28, 2013 4:46 PM
> Subject: [DynoMotion] Re: Kanalog -> RS232 -> Innomotion PLC
>
>
>
> Â
> Hi TK,
>
> I am enable to use this commands:
> {"\x01\x03\x10\x00\x00\x02", 6, 0}, // Read inputs to MBRegisters[0]
> {"\x01\x10\x10\x02\x00\x02", 6, 1}, // Write outputs from MBRegisters[1]
> (Before I was writing the outputs, now I am writing registers and copy those to the outputs with the PLC)
>
> I can read 8 inputs and write 8 outputs.
> Is it possible to expand this to 16 or even better to 32?
>
> With kind regards,
>
> Frank
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Frank,
> >
> > Yes I think RTU mode is more like the code is expecting.
> >
> > I think our original 16-bit CRC calculation would probably work.ÃÂ It is just using those tables to do it much faster than the bit-by-bit like described in the document.
> >
> > I didn't realize the code prints a message if the connect list is empty.ÃÂ But that should not be a problem.ÃÂ Just ignore the message on the console that says:
> >
> >
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ModbusMaster_Send: Tried to execute at end list
> >
> >
> > But the next error is:
> >
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ Unexpected default: ModbusMaster_Send(), Function -112
> >
> > This means you changed the table to have an invalid ModBus command.ÃÂ Only 0x03, 0x04, and 0x10 are supported.
> >
> > You did not attach the code you are using.
> >
> > Yes change:
> >
> > double ModbusMaster_EndOfPacketWait=3.5*10/9600
> >
> > for whatever baud rate you are using.
> >
> > The PLC must be set for no parity and 1 stop bit.
> >
> > Regards
> > TK
> >
> >
> >
> >
> > ________________________________
> > From: frank_19_88 <frank_19_88@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Sunday, April 28, 2013 8:12 AM
> > Subject: [DynoMotion] Re: Kanalog -> RS232 -> Innomotion PLC
> >
> >
> >
> > ÃÂ
> > Hi TK,
> >
> > Good to hear that the RS232 port has been tested.
> >
> > I did change the PLC CRC Checksum setting to 16 bit.
> > Also set PLC settings from ASCII to RTU mode because you talked about CRC. (CRC is used for RTU mode, LRC is used for ASCII mode)
> > And I installed the latest version 4.31c. (Version change did not change console result)
> >
> > I found this about the PLC:
> > Source: http://www.kavrammuhendislik.com.tr/dokumanlar/DELTA_DVP-ES2_SS2_SA2_SX2-Program_O_EN_20110302.pdf
> > Page: 560
> >
> > Console after I changed to RTU:
> > "
> > Modbus Master Init
> > List:0 ConnectIndex:0 MonitorIndex:0
> > ModbusMaster_Send: Tried to execute at end list
> > Unexpected default: ModbusMaster_Send(), Function -112
> > ModbusMaster_Retry:1
> > List:0 ConnectIndex:0 MonitorIndex:0
> > ModbusMaster_Send: Tried to execute at end list
> > Tx:01;04;04;00;00;01;30;fa;
> > Unexpected default: Process_Data(), Buffer[1]=132
> > List:0 ConnectIndex:2 MonitorIndex:0
> > Unexpected default: Process_Data(), Buffer[1]=144
> > Unexpected default: Process_Data(), Buffer[1]=132
> > Unexpected default: Process_Data(), Buffer[1]=144
> > Unexpected default: Process_Data(), Buffer[1]=132
> > "
> > After that it repeatedly prints "Unexpected default: Process_Data(), Buffer[1]=132/144"
> >
> > When I disconnect the rs232 cable:
> > "
> > Unexpected default: Process_Data(), Buffer[1]=132
> > ModbusMaster_Retry:1
> > Tx:01;10;05;00;00;01;02;00;20;f2;88;
> >
> > Seconds: 10
> > ModbusMaster_MonitorCycleTime=0.014936 (66.950268/s)
> > ModbusMaster_TallyCommands/s=110
> > ModbusMaster_TallyConnections=1
> > ModbusMaster_TallyRetries=2
> > ModbusMaster_Retry:2
> > Tx:01;10;05;00;00;01;02;00;20;f2;88;
> >
> > Modbus Master Init
> > List:0 ConnectIndex:0 MonitorIndex:0
> > ModbusMaster_Send: Tried to execute at end list
> > ModbusMaster_Retry:1
> > List:0 ConnectIndex:0 MonitorIndex:0
> > ModbusMaster_Send: Tried to execute at end list
> > Tx:01;04;04;00;00;01;30;fa;
> > ModbusMaster_Retry:2
> > List:0 ConnectIndex:1 MonitorIndex:0
> > Tx:01;04;04;00;00;01;30;fa;
> > "
> >
> > I changed the .c code as the PLC document tells:
> > "
> > unsigned short CRC16(unsigned char *puchMsg,unsigned char usDataLen)
> > {
> > int j;
> > unsigned int reg_crc=0Xffff;
> > while(usDataLen--)
> > {
> > reg_crc ^= *puchMsg++;
> > for (j=0;j<8;j++)
> > {
> > if (reg_crc & 0x01) reg_crc=(reg_crc>>1) ^ 0Xa001; /* LSB(b0)=1 */
> > else reg_crc=reg_crc >>1;
> > }
> > }
> > return reg_crc;
> > // the value that sent back to the CRC register finally
> > }
> >
> > //unsigned short CRC16(unsigned char *puchMsg,unsigned short usDataLen)
> > // {
> > // unsigned char uchCRCHi = 0xff;
> > // unsigned char uchCRCLo = 0xff;
> > // unsigned int uIndex;
> > // while(usDataLen--)
> > // {
> > // uIndex = uchCRCLo ^ *puchMsg++;
> > // uchCRCLo = uchCRCHi ^ auchCRCHi[uIndex];
> > // uchCRCHi = auchCRCLo[uIndex];
> > // }
> > // return (uchCRCHi<<8|uchCRCLo);
> > // }
> > "
> >
> > But same result.
> >
> > I think we made process because the console changes after disconnecting the cable.
> > Maybe the PLC answer cant be read with the kfop .c code?
> >
> > Ps. Kflop bit 48-55 and PLC output status don't change after running the .c code.
> > Your ModbusMasterVer1.c sample has one line "double ModbusMaster_EndOfPacketWait=3.5*10/9600; // wait 3.5 characters after a packet 9600=baud rate)" do I have to change it to "38400" ??
> >
> > With kind regards,
> >
> > Frank
> >
> > --- In DynoMotion@yahoogroups.com, TK <tk@> wrote:
> > >
> > > Hi Frank,
> > >
> > > You will need to write a small function from scratch to do the 8-bit checksum according to the formula in the document for your PLC. You can't just write out half of the 16-bit CRC value. They are completely different algorithms.
> > >
> > > Yes the Kanalog RS232 port has been tested.
> > >
> > > Use the latest Test Version 4.31c
> > >
> > > Regards
> > > TK
> > >
> > > On Apr 27, 2013, at 5:30 PM, "frank_19_88" <frank_19_88@> wrote:
> > >
> > > > HI TK,
> > > >
> > > > I changed it to:
> > > > int csum=CRC16(ModbusMaster_packetBuild,chp-ModbusMaster_packetBuild);
> > > > *chp++=csum&0xFF;
> > > > //*chp++=(csum>>8)&0xFF;
> > > > (CRC8, didn't work)
> > > >
> > > > Console changed from "Tx:01;10;05;00;00;01;02;00;3f;b3;40;" to "Tx:01;10;05;00;00;01;02;00;3f;b3;" but still no connection.
> > > >
> > > > Did you test the rs232 connection of the kanalog? (half year ago you said you didn't)
> > > > Do I need to upgrade version "430f"?
> > > >
> > > > If you want to try it for your self you can login true Teamviewer or remote desktop.
> > > >
> > > > Or do you have any other suggestions?
> > > >
> > > > With kind regards,
> > > >
> > > > Frank
> > > >
> > > > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > > >
> > > > > Hi Frank,
> > > > >
> > > > > Here is where the 16-bit CRC code is added in:
> > > > >
> > > > > int csum=CRC16(ModbusMaster_packetBuild,chp-ModbusMaster_packetBuild);
> > > > > *chp++=csum&0xFF;
> > > > > *chp++=(csum>>8)&0xFF;
> > > > >
> > > > >
> > > > > You would need to change that to do the simple 8-bit sum.
> > > > >
> > > > > Regards
> > > > > TK
> > > > >
> > > > >
> > > > >
> > > > > ________________________________
> > > > > From: frank_19_88 <frank_19_88@>
> > > > > To: DynoMotion@yahoogroups.com
> > > > > Sent: Saturday, April 27, 2013 11:13 AM
> > > > > Subject: [DynoMotion] Re: Kanalog -> RS232 -> Innomotion PLC
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Hi TK,
> > > > >
> > > > > (Also see my message from yesterday)
> > > > >
> > > > > Today I did change baud rate from kflop back to 38400 at the .c file.
> > > > > I think the modbus commands are very similar, Innomotion PLC also support this
> > > > > command:
> > > > > {"\x01\x10\x05\x00\x00\x01", 6, 1}, // Write outputs
> > > > > "x05" instead of "xE2" because the outputs are at and different address.
> > > > > At the console I receive:
> > > > > "Tx:01;10;05;00;00;01;02;00;3f;b3;40;"
> > > > > I think the problem is at the Error Check (LRC) kflop sends 2 byte's and the PLC
> > > > > document says 1 byte.
> > > > >
> > > > > "3f" changed :) when 56-61 change :)
> > > > > Maybe useful:
> > > > > http://www.kavrammuhendislik.com.tr/dokumanlar/DELTA_DVP-ES2_SS2_SA2_SX2-Program_O_EN_20110302.pdf
> > > > >
> > > > > Hope you have any idea how to fix it.
> > > > >
> > > > > Frank
> > > > >
> > > > > --- In DynoMotion@yahoogroups.com, "frank_19_88" <frank_19_88@> wrote:
> > > > > >
> > > > > > Hi TK,
> > > > > >
> > > > > > I changed the PLC settings from "9600,7,even,1" To "Baud:38400, 8 Bits, None, 1 stop bit".
> > > > > >
> > > > > > But I don't know how I can send "\x01\x10\xE2\x00\x00\x01" with teraterm. (Also tried realterm)
> > > > > >
> > > > > > I am enable to change the PLC outputs with the PC software "delta soft: ISPSoft V1.03" (true rs232) but I can't monitor the com port at that time.
> > > > > >
> > > > > > With kind regards,
> > > > > >
> > > > > > Frank
> > > > > >
> > > > > >
> > > > > > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > > > > >
> > > > > > > Hi Frank,
> > > > > > >
> > > > > > >
> > > > > > > I was able to download the .rar file only.
> > > > > > >
> > > > > > > Like I said previously I would make the connnect List empty to simplify things as that was just intended to read version info and such from the PLC.ÃÆ'ââ¬Å¡ so delete ÃÆ'ââ¬Å¡ ÃÆ'ââ¬Å¡ ÃÆ'ââ¬Å¡
> > > > > > >
> > > > > > >
> > > > > > > {"\x3A\x01\x11\xEE", 4, 0},ÃÆ'ââ¬Å¡ ÃÆ'ââ¬Å¡ ÃÆ'ââ¬Å¡ // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > > > > >
> > > > > > > Also use:
> > > > > > >
> > > > > > > ÃÆ'ââ¬Å¡ ÃÆ'ââ¬Å¡ ÃÆ'ââ¬Å¡ EnableRS232Cmds(RS232_BAUD_9600);
> > > > > > >
> > > > > > >
> > > > > > > for 9600 baud.
> > > > > > >
> > > > > > > The PLC document talks about 7bits even parity.ÃÆ'ââ¬Å¡ KFLOP only does 8 bits no parity (although it would be possible to add parity in software), but the hex command examples seem to be no parity.
> > > > > > >
> > > > > > > It isn't clear to me from their documentation if that ":" character or STX or 0x3A is actually needed and sent.ÃÆ'ââ¬Å¡ I would try removing it.
> > > > > > >
> > > > > > > The CR and LF are carriage return and line feed characters.ÃÆ'ââ¬Å¡ But the checksum and those are added automatically.
> > > > > > >
> > > > > > > You may want to connect your PLC to a PC and user TeraTerm to type characters to test things first.
> > > > > > >
> > > > > > > Regards
> > > > > > > TK
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > ________________________________
> > > > > > > From: frank_19_88 <frank_19_88@>
> > > > > > > To: DynoMotion@yahoogroups.com
> > > > > > > Sent: Sunday, April 21, 2013 2:04 PM
> > > > > > > Subject: [DynoMotion] Re: Kanalog -> RS232 -> Innomotion PLC
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > ÃÆ'ââ¬Å¡
> > > > > > > Hi TK,
> > > > > > >
> > > > > > > At 'http://www.cncretrofit.nl/Kflop/RS232 - Console.txt' you can see the console information
> > > > > > > At 'http://www.cncretrofit.nl/Kflop/RS232 - DRS232 - VP_ communication Protocol.doc' you can find the communication protocol of the PLC. (I have 8 inputs and 6 outputs on de PLC, and an IO board with 8 inputs and 8 outputs)
> > > > > > > At 'http://www.cncretrofit.nl/Kflop/ModbusMasterVer1.c' you will find the new .c file
> > > > > > >
> > > > > > > Or: 'http://www.cncretrofit.nl/Kflop/kflop.rar'
> > > > > > > Or: 'http://www.hoefon.nl/kflop/kflop.rar'
> > > > > > >
> > > > > > > I did add the flag, the program doesn't crash any more.
> > > > > > >
> > > > > > > The documentation of the PLC say:
> > > > > > > Command code 17: 3A;01;11;EE
> > > > > > > Heading :3A
> > > > > > > Slave address :01
> > > > > > > command code :11
> > > > > > > error check (LRC) :EE
> > > > > > >
> > > > > > > Command code 01: 3A;01;01;04;00;00;08;BF;CR;LF
> > > > > > > Command code 15: 0F;05;00;00;06;01;3F;11;CR;LF
> > > > > > > ( I think CR;LF is strange because it is not hexadecimal )
> > > > > > >
> > > > > > > I hope you can open de documents.
> > > > > > > Maybe I have the wrong communication settings?
> > > > > > >
> > > > > > > 1. Communication Interface: RS-232C
> > > > > > > 2. Communication Protocol ASCII mode, 9600(Baud rate),7(Data length), EVEN(Parity),1(Stop bit)
> > > > > > > 3. Communication Data Frame
> > > > > > > STX Start character `:'(3AH)
> > > > > > > ADR 1 Communication address:
> > > > > > > ADR 0 8-bit address consists of 2 ASCII codes
> > > > > > > CMD 1 Command code:
> > > > > > > CMD 0 8-bit command consists of 2 ASCII codes
> > > > > > > DATA(0) Contents of data:
> > > > > > > DATA(1) n8-bit data consist of 2n ASCII codes.
> > > > > > > ÃÆ'ââââ¬Å¡Ã¬ÃâæÃÆ'ââââ¬Å¡Ã¬ÃâæÃÆ'ââââ¬Å¡Ã¬Ãâæ. n37, maximum of 74 ASCII codes
> > > > > > > DATA(n-1)
> > > > > > > LRC CHK 1 LRC check sum:
> > > > > > > LRC CHK 0 8-bit check sum consists of 2 ASCII codes
> > > > > > > END 1 End character:
> > > > > > > END 0 END 1 = CR(0DH),END 0 = LF(0AH)
> > > > > > >
> > > > > > > With kind regards,
> > > > > > >
> > > > > > > Frank
> > > > > > >
> > > > > > > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > > > > > >
> > > > > > > > Hi Frank,
> > > > > > > >
> > > > > > > > It looks like you commented out the end flag in the MonitorList Table which is likely to cause the program to crash.
> > > > > > > >
> > > > > > > > change
> > > > > > > >
> > > > > > > > //{0,0,0} // end flag
> > > > > > > >
> > > > > > > > to
> > > > > > > >
> > > > > > > > {0,0,0} // end flag
> > > > > > > >
> > > > > > > > Your links to cncretrofit.nl don't work for me.
> > > > > > > >
> > > > > > > >
> > > > > > > > Also notice in the example there are 8 things for each entry in the table (6 characters and 2 numbers) as described in the comment
> > > > > > > >
> > > > > > > >
> > > > > > > > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added as necessary.
> > > > > > > > //{"\x01\x04\xE0\x00\x00\x01", 6, 0}, // Read inputs to MBRegisters[0]
> > > > > > > >
> > > > > > > > you changed to 6 things??ÃÆ'Ã'âââ¬Ã
¡ÃÆ'ââ¬Å¡ (4 characters and 2 numbers):
> > > > > > > >
> > > > > > > > {"\x3A\x01\x11\xEE", 4, 0}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > Similarly the changes to the other table don't fit the required format.
> > > > > > > >
> > > > > > > >
> > > > > > > > I would also remove everything in the Connect list as it is not really needed to read the diagnostic information (but leave the end flag)
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > Regards
> > > > > > > > TK
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > ________________________________
> > > > > > > > From: frank_19_88 <frank_19_88@>
> > > > > > > > To: DynoMotion@yahoogroups.com
> > > > > > > > Sent: Sunday, April 21, 2013 10:22 AM
> > > > > > > > Subject: [DynoMotion] Kanalog -> RS232 -> Innomotion PLC
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > ÃÆ'Ã'âââ¬Ã
¡ÃÆ'ââ¬Å¡
> > > > > > > > Hey TK,
> > > > > > > >
> > > > > > > > At the moment I started the rs232 project.
> > > > > > > >
> > > > > > > > I am using KMotion430f.exe (Kflop + Kanalog)
> > > > > > > > And did buy this plc: http://www.innomotion.eu/plc/dvp-ss2.html
> > > > > > > > And connected Kanalog rs232 to the plc (Connected the transfer bit from the Kanalog to the receive bit of the PLC and receive to transfer and ground to ground)
> > > > > > > >
> > > > > > > > I did change your ModbusMasterVer1.c:
> > > > > > > > ModbusMaster_Cmds ModbusMaster_ConnectList[] =
> > > > > > > > {
> > > > > > > > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added.
> > > > > > > > //{"\x01\x04\xF0\x00\x00\x10", 6, 2}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > > > > > > {"\x3A\x01\x11\xEE", 4, 0}, // Collect PLC firmware info block MBRegisters[10] for 16 registers
> > > > > > > > {0,0,0} // end flag
> > > > > > > > };
> > > > > > > >
> > > > > > > > ModbusMaster_Cmds ModbusMaster_MonitorList[] =
> > > > > > > > {
> > > > > > > > // string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added as necessary.
> > > > > > > > //{"\x01\x04\xE0\x00\x00\x01", 6, 0}, // Read inputs to MBRegisters[0]
> > > > > > > > //{"\x01\x10\xE2\x00\x00\x01", 6, 1}, // Write outputs from MBRegisters[1]
> > > > > > > > {"\3A\x01\x01\x04\x00\x00\x08\xBF", 8, 0}, // Read inputs to MBRegisters[0]
> > > > > > > > {"\x0F\x05\x00\x00\x06\x02\xCD\x01\x11", 9, 1}, // Write outputs from MBRegisters[1]
> > > > > > > > //{0,0,0} // end flag
> > > > > > > > };
> > > > > > > > And changed baud rate to 9600.
> > > > > > > >
> > > > > > > > But when I run the code it gives me an error 'Read failed - Auto disconnect'
> > > > > > > > At 'www.cncretrofit.nl/Kflop/RS232 - Console.txt' you can see the console information
> > > > > > > > At 'www.cncretrofit.nl/Kflop/RS232 - DRS232 - VP_ communication Protocol.doc' you can find the communication protocol of the PLC. (I have 8 inputs and 6 outputs on de PLC, and an IO board with 8 inputs and 8 outputs)
> > > > > > > > At 'www.cncretrofit.nl/Kflop/ModbusMasterVer1.c' you will find the new .c file
> > > > > > > >
> > > > > > > > Command code 17: {"\x3A\x01\x11\xEE", 4, 0}
> > > > > > > > Command code 01: {"\3A\x01\x01\x04\x00\x00\x08\xBF\xCR\xLF", 10, 0}, // 04 "X" are inputs, Read inputs to MBRegisters[0]
> > > > > > > > Command code 15: {"\x0F\x05\x00\x00\x06\x02\xCD\x01\x11\xCR\xLF", 11, 0}, // 05 "Y" are outputs Write outputs from MBRegisters[1]
> > > > > > > >
> > > > > > > > Can you/I write an C program to send 3A:01:11:EE to the PLC? And read the answer to check the connection?
> > > > > > > > After that we can try to read/write the PLC.
> > > > > > > >
> > > > > > > > Thank you,
> > > > > > > >
> > > > > > > > Frank
> > > > > > > >
> > > > > > >
> > >
> >
>
|
|
| | | | | | | | | |